[Fixed]-How to create all django apps inside a folder?

9πŸ‘

βœ…

  1. At first, you need to create a directory Your_App_Name inside the /apps folder.
  2. After that, run the following command to create the new app
python manage.py startapp Your_App_Name ./apps/Your_Apps_Folder_Name/

Then don’t forget to add just created app name in the settings.py like below:

INSTALLED_APPS = [
    ...,
    'apps.Your_App_Name',
]

8πŸ‘

You can specify the path to destination directory after app_label in the startapp command.

python manage.py startapp <app_label> [destination]

In your case you the command is like this:

python manage.py startapp budget ./apps

Then you should add just created app name in settings.py like below:

INSTALLED_APPS = [
    ...,
    'apps.budget',
]
πŸ‘€mrzrm

4πŸ‘

You can also do it like this

cd apps && django-admin startapp app_name
πŸ‘€Koushik Das

2πŸ‘

First run python manage.py startapp budget app/budget

Then, on your settings.py, change the INSTALLED_APPS to the full path name:

INSTALLED_APPS = [
'app.budget.apps.BudgetConfig',
]
πŸ‘€Lord Elrond

1πŸ‘

If you’re on Windows, you’ll first need to create a folder app/budget. Then add the file __init__.py to the folder add. Then run the command py manage.py startapp budget app/budget.
Then, on your settings.py, change the INSTALLED_APPS to the full path

name:`INSTALLED_APPS = [
    ...,
    'app.budget',
]`

also need to change the name of the app in apps.py as follows

class BudgetConfig(AppConfig):
    default_auto_field = 'django.db.models.BigAutoField'
    name = 'app.budget'

0πŸ‘

When you use a nested structure for apps, you also need to change the name of the app in apps.py as follows:

class BudgetConfig(AppConfig):
    default_auto_field = 'django.db.models.BigAutoField'
    name = 'apps.budget'

Check https://code.djangoproject.com/ticket/24801 for more information.

πŸ‘€Mehdi Zare

0πŸ‘

I am making the following assumptions:

  1. You are on a Unix/Linux PC
  2. Your app is named: perstep
1. mkdir -p apps/perstep && touch apps/__init__.py
2. python manage.py startapp perstep ./apps/perstep

OR

1. mkdir -p apps && touch apps/__init__.py
2. cd apps && django-admin startapp perstep

configurations

reference the added diagram when in doubt.

1. In settings.py "INSTALLED_APPS" add "apps.perstep.apps.PerstepConfig" to it.

β”œβ”€β”€ apps
β”‚Β Β  β”œβ”€β”€ __init__.py
β”‚Β Β  └── perstep
β”‚Β Β      β”œβ”€β”€ apps.py

2. Change name = 'apps.perstep' within 'apps > perstep > apps.py' PerstepConfig

This works as at Django==4.0.5

πŸ‘€iChux

Leave a comment