woodyle

博客园 首页 新随笔 联系 订阅 管理

1、$python manage.py runserver 0.0.0.0:8000  开放所有IP

$python manage.py runserver 8000 制定开放的端口

2、报错信息: Error loading MySQLdb module: No module named MySQLdb

解决方法:$sudo pip install mysql

3、报错信息:You called this URL via POST, but the URL doesn't end in a slash and you have APPEND_SLASH set.

解决方法:将from的action地址改为/结尾的就可以了或者修改settings:APPEND_SLASH=False

4、apache+django,需要安装mod_wsgi(遇到依赖包问题,可以尝试根据报错结果remove&install),修改 /etc/httpd/conf/httpd.conf

LoadModule wsgi_module modules/mod_wsgi.so
# Django
WSGIScriptAlias / /home/ec2-user/mysite/mysite/wsgi.py
WSGIPythonPath /home/ec2-user/mysite
<Directory /home/ec2-user/mysite/mysite>
     <Files wsgi.py>
        Order deny,allow
        Require all granted
     </Files>
</Directory>

User apache   #修改用户
Group apache

<Directory "/home/ec2-user/mysite">
    AllowOverride None
    Require all granted
</Directory>

<Directory "/home/ec2-user/mysite/mysite">
    AllowOverride None
    Require all granted
</Directory>

5、注意关闭settings.py中的debug

posted on 2015-09-05 19:16  woodyle  阅读(170)  评论(0编辑  收藏  举报