I m new to django. I created a web with dajngo,and successfully deployed it in the server
The python app has been successfully setup and virtual environment has been setup.
but while running the web it gives me “Server Error (500)” I don’t know whats the problem.
I think error is in “wsgi.py” file but i’m unable to idenify it.
My wsgi file:
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'karan_web.settings')
application = get_wsgi_application()
my “passenger_wsgi.py” file is:
import imp
import os
import sys
sys.path.insert(0, os.path.dirname(__file__))
wsgi = imp.load_source('wsgi', 'karan_web/wsgi.py')
application = wsgi.application
can someone help me with it;
3
Answers
Sorry for the late answer, I had figured out the as to this just forgot to post it. As I stated in my question, the actual problem was in passenger_wsgi.py, the django server starts with the wsgi.py and act as the gate way to the Django server. So whenever a Django project is uploaded on the hosting server, It creates a passenger_wsgi.py file and one default wsgi.py, address of which is provided in passenger_wsgi.py by default. So we just need to change that address and provide the address of our own wsgi.py in the project
In my case it was
You need to check if your code syntax is correct and running properly. If its still doesn’t work try to delete and recreate your database in cpanel and check if you have made all necessary migrations, don’t forget to restart your python app. If after all these it still doesn’t work check if all your files have the correct file permission(766).
just edit in passenger_wsgi.py the following code.