4👍
I fixed it by adding the project path to sys.path
on the wsgi.py
itself. Maybe you can try so.
0👍
Try modifying the DJANGO_SETTINGS_MODULE
value in wsgi.py
and .ebextenstions/myproject.config
to be myproject.settings.active
.
- [Django]-Django settings based on IP or hostname
- [Django]-Django 2.0 Trying to Grab the primary key with regular Expressions but im getting 404
- [Django]-Specify choices in model and RadioButton in ModelForm renders not selected value "——"
- [Django]-Django rest framework non-model serializer
- [Django]-Nginx gunicorn 502 bad gateway: upstream prematurely closed connection while reading response header from upstream
0👍
Even though I was also able to solve the settings import problem with Andres answer and the follow up comments by Unoti –>
To use the wsgi as produced by django (in my case 1.9), add this to the wsgi file:
sys.path.insert(0, os.path.abspath(os.path.dirname(os.path.dirname(__file__))))
I found this to be an interesting read that still seems relevant:
Secondly, that wsgi.py was auto generated, it gave users the
impression that it would always be correct, must be used and wouldn’t
need modifying. Consequence was that people stopped seeing what one of
the main roles of the WSGi script file was for, which was to set
environment variables before the Django application got loaded.
…from: https://gist.github.com/GrahamDumpleton/b380652b768e81a7f60c
2. So since we are no longer assuming that the location and contents of the wsgi file are set in stone for production another option would be to copy your wsgi file outside of the project and simply change the settings module path address setting.
ps.
I will mention, even though this probably won’t work for you since you don’t have access to an apache configuration (?), but (for those who do,) you can use the ‘python-path’ configuration via:
WSGIDaemonProcess example.com python-home=/path/to/venv python-path=/path/to/mysite.com
- [Django]-Django – Sending post request using a nested serializer with many to many relationship. Getting a [400 error code] "This field may not be null] error"
- [Django]-Updating a Django list view with ajax