在Webfaction上部署Django项目 [英] Deploying Django Project on Webfaction

查看:187
本文介绍了在Webfaction上部署Django项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Django和Web开发人员一般都是个新手。我一直在使用本地制作Django项目的教程和指南。现在,我想将我的项目部署到WebFaction。我遵循了这里的所有说明: https://docs.webfaction.com/软件/ django / getting-started.html



然而,在完成所有这些操作后,当我进入域名时,它只是说:


内部服务器错误



服务器遇到内部错误或配置错误,为
无法完成您的请求。



请联系服务器管理员[无地址]至
通知他们此错误发生的时间,以及操作您在此错误之前执行



有关此错误的更多信息可能在服务器错误
日志中可用。


根据WebFaction的一键设置,我制作的应用程序基于Django 1.8.6,mod_wsgi 4.4.21和Python 3.4。我坚持使用默认的Apache + mod_wsgi和PostgreSQL作为数据库。包装I包装包括:




  • 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

  • 枕头== 3.0。 0



我的生产settings.py包括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>'),('',''))

我注意到的一个差异是服务器上的python3的默认版本为3.5(使用 python3 -V ),因此我创建了一个目录:〜/ lib / python3.5 ,但在我的应用程序中,Python 3.4被安装在一键设置中,所以我有一个目录:〜/ webapps /< proj_name> /lib/python3.4



我一直在尝试通过网络爬网,但是找不到任何有用的东西,或者最终难以理解,甚至可能不是我需要的术语。帮助将不胜感激!谢谢

解决方案

感谢您的所有提示和说明!他们确实导致了我的最终解决方案,因为错误显示django软件包没有安装(但他们是!)所以按照我的初步猜测,我只是更改了〜/ lib / python3 .5 〜/ lib / python3.4 ,它变得好了。


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

解决方案

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.

这篇关于在Webfaction上部署Django项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆