I am writing a Django project that it needs to be divided as production/development, but however my project looks like this, how can I organize in order to execute python manage.py runserver for dev or prod.
.
├── apps
│ ├── account
│ │ ├── migrations
│ │ │ └── __pycache__
│ │ └── __pycache__
│ ├── course
│ │ ├── migrations
│ │ └── __pycache__
│ ├── quizgame
│ │ ├── migrations
│ │ │ └── __pycache__
│ │ └── __pycache__
│ └── site
│ └── __pycache__
└── app
└── __pycache__
16 directories
As I remember,
settings.pymust be insideappdirectory. So, you need to create new directory insideapp, for example with namesettings. Then you need to modifymanage.pyand set the next code:Then, you can create two new files
dev_settings.pyandprod_settings.pyinsettingsfolder.Now, you can run code with other settings, but you need to add parameter
--settings=settings.dev_settingsto all your management commands, for example:or
I hope, I helped you.