6👍
✅
The problem was in the include path:
import sys
#Wrong!
#sys.path.append("/home/user/mysite/mysite")
#Correct
sys.path.append("/home/user/mysite")
👤u123
19👍
Add this to your wsgi.py
file:
path = '/home/path/to/project'
if path not in sys.path:
sys.path.append(path)
before setting
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
19👍
Please try:
import os
import sys
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(BASE_DIR)
os.environ['DJANGO_SETTINGS_MODULE'] = 'YOURAPP.settings'
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "YOURAPP.settings")
This is working for scripts in main project directory, as well.
- Error Map Keys Must be unique while using YAML extension field in docker compose for django application
- PyCharm does not resolve templates nor template tags nor statics in Django project
- How to change django datetime format output?
1👍
I had this error too, when I was trying to move a windows project to Debian.
import sys
sys.path.append("your project path")
- Django is very slow on my machine
- RuntimeError: __class__ not set defining 'AbstractBaseUser' as <class 'django.contrib.auth.base_user.Abstract BaseUser'>. Was __classcell__ propagated
- Django 1.8 migration unable to cast column id to integer
0👍
Also, if you are using Visual Studio, check that your app properties for Django match the settings module that you are expecting. By default, it is set to $(MSBuildProjectName).settings, which was a problem for me since my project name and app name were not the same.
You can find this setting by right clicking on your app in the Solution Explorer and clicking on “Properties” and then the Django tab on the left.
👤Dima
- Error: command 'x86_64-linux-gnu-gcc' when installing mysqlclient
- Error while accessing sqlite3 shell from django application
- Gunicorn sync workers spawning processes
Source:stackexchange.com