14๐
I do know that no matter what you do with manage.py
, youโre going to get that error because manage.py
does a relative import of settings
:
try:
import settings # Assumed to be in the same directory.
http://docs.djangoproject.com/en/dev/ref/django-admin/#django-admin-optionโsettings
Note that this option is unnecessary
in manage.py, because it uses
settings.py from the current project
by default.
You should try django-admin.py syncdb --settings=mysettings
instead
24๐
Try creating a settings
module.
- Make a
settings
folder in the same directory asmanage.py
. - Put your different settings files in that folder (e.g.
base.py
andprod.py
). -
Make
__init__.py
and import whatever settings you want to use as your default. For example, your__init__.py
file might look like this:from base import *
-
Run your project and override the settings:
$ python2.6 manage.py syncdb --settings=settings.prod
- [Django]-Running ./manage.py migrate during Heroku deployment
- [Django]-Django: How to format a DateField's date representation?
- [Django]-Using Django Managers vs. staticmethod on Model class directly
4๐
this works for me:
DJANGO_SETTINGS_MODULE=config.settings.abc python manage.py migrate
- [Django]-Django user profile
- [Django]-Can Redis write out to a database like PostgreSQL?
- [Django]-Self.instance in Django ModelForm
1๐
this will help you:
-
create a another file โsetting_prod.pyโ with your original settings.py file.
-
write down your setting which you need to run, in setting_prod.py file.
-
Then import setting_prod.py file in your settings.py file.
for ex.
settings.py:
VARIABLE = 1
import setting_prod
setting_prod.py
VARIABLE = 2
After importing setting_prod.py file in settings.py file, VARIABLE will set to new value to โ2โ from โ1โ.
- [Django]-Developing with Django+Celery without running `celeryd`?
- [Django]-How can I avoid "Using selector: EpollSelector" log message in Django?
- [Django]-Reload django object from database
0๐
We can use this method to set different settings file, for example, I use different settings file for my unit test (settings_unit_test.py). Also I do have other settings file for different infrastructure environment settings_dev.py, settings_test.py and settings_prod.py.
In windows environment(same can done in linux as well)
set DJANGO_SETTINGS_MODULE=settings_unit_test
set PYTHONPATH=<path_of_your_directory_where_this_file_'settings_unit_test.py'_is_kept>
- [Django]-Django Rest Framework โ Updating a foreign key
- [Django]-Django TypeError: get() got multiple values for keyword argument 'invoice_id'
- [Django]-Fastest way to get the first object from a queryset in django?