问题
I'm quite a newbie in Django, and web dev in general. I've been following tutorials and guides in making a Django project locally. Now, I want to deploy my project to WebFaction. I followed all of their instructions found here: https://docs.webfaction.com/software/django/getting-started.html
However, after doing all of these, when I go to the domain, it simply says:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at [no address given] to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
The app I made is based on Django 1.8.6, mod_wsgi 4.4.21, and Python 3.4 as per WebFaction's one-click setup. I'm sticking to the default Apache + mod_wsgi, and PostgreSQL for my database. Packages I pip installed include the likes of:
- django-allauth==0.23.0
- django-analytical==1.0.0
- django-crispy-forms==1.5.2
- django-postman==3.3.1
- django-haystack==2.4.0
- elasticsearch==2.0.0
- Pillow==3.0.0
My production settings.py include the ff:
DEBUG = False
ALLOWED_HOSTS = [
'mydomain.ph',
'www.mydomain.ph',
'myusername.webfactional.com'
]
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': '< my_db_name >',
'USER': '< my_db_user >',
'PASSWORD': '< my_db_pass >',
'HOST': '127.0.0.1',
'PORT': '5432',
}
}
STATIC_ROOT = '/home/<my_wf_user>/webapps/static/'
ADMINS = (('<my_name>', '<my_email>'), ('',''))
One discrepancy I noticed was that python3 on the server had a default version of 3.5 (checked with python3 -V
), hence I created a dir: ~/lib/python3.5
, but in my app, Python 3.4 was installed in the one-click setup, so I have a dir: ~/webapps/<proj_name>/lib/python3.4
I have been trying to crawl through the web, but either can't find anything useful or end up with incredibly difficult to understand jargon that may not even be what I need. Help would be greatly appreciated! Thank you
回答1:
Look into your Apache log file, it should contain the error encountered either at the Apache level or mod_wsgi level. I think the log will be located at the user log folder. If it's not there you can also check the front end log.
回答2:
Thank you for all of your tips and instructions! They did lead me to my eventual solution, as the errors showed that the django packages "were not installed" (but they were!) so in accordance with my initial speculation, I simply changed ~/lib/python3.5
to ~/lib/python3.4
and it became alright.
来源:https://stackoverflow.com/questions/33795356/deploying-django-project-on-webfaction