Reputation: 45
i started a new project in Django but local environment settings come from the previous project.
So how can i reset local environment settings?
Thank you..
Upvotes: 1
Views: 1902
Reputation: 964
First, in your project folder create a virtualenv:
python -m venv .venv
Activate your virtualenv:
source .venv/bin/activate
Install Django with your virtualenv activated:
pip install django
Then install python-decouple:
pip install python-decouple
It helps you to extract your local settings.
.env
SECRET_KEY=CHANGE_THIS_FOR_YOUR_SECRET_KEY
DEBUG=True
settings.py
from decouple import config
SECRET_KEY = config('SECRET_KEY')
DEBUG = config('DEBUG', default=False, cast=bool)
For last, but not less important, add the .env file in your .gitignore, so any developer who gets your code won't use your local settings.
Upvotes: 2
Reputation: 89
Started a new project. And you replaced the settings.py from another project? If so just update your database and install the required packages with pip. To update the database: python manage.py makemigrations and then python manage.py migrate.
Upvotes: 0