最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 科技 - 知识百科 - 正文

DjangoMezzanineuwsginginx配置

来源:动视网 责编:小采 时间:2020-11-27 14:28:43
文档

DjangoMezzanineuwsginginx配置

DjangoMezzanineuwsginginx配置:1, mezzanine介绍mezzanine就是一个基于Django框架的应用, 详细可以参考官方网站:http://mezzanine.jupo.org/2, Mezzanine 安装指南:# Install from PyPI $ pip install mezzanine # Create a project $ me
推荐度:
导读DjangoMezzanineuwsginginx配置:1, mezzanine介绍mezzanine就是一个基于Django框架的应用, 详细可以参考官方网站:http://mezzanine.jupo.org/2, Mezzanine 安装指南:# Install from PyPI $ pip install mezzanine # Create a project $ me


1, mezzanine介绍

mezzanine就是一个基于Django框架的应用, 详细可以参考官方网站:http://mezzanine.jupo.org/

2, Mezzanine 安装指南:

# Install from PyPI 
$ pip install mezzanine 
 
# Create a project 
$ mezzanine-project myproject 
$ cd myproject 
 
# Create a database 
$ python manage.py createdb 
 
# Run the web server 
$ python manage.py runserver

新建的项目如果要修改主题可以参考:https://github.com/renyi/mezzanine-themes.git

3,修改 nginx的配置文件

到你的 nginx 安装目录下的 conf目录下 修改配置文件 nginx.conf.

**** 关于部署由于之前静态文件的设置问题

 
cd /usr/local/nginx/conf/ 
gedit nginx.conf

添加如下内容:

注意 修改你对应项目的路径 比如 alias /home/daniel/myblog/static;

 server { 
 listen 8080; 
 server_name 123456; 
 
 location / { 
 root /home/daniel/myblog/; 
 uwsgi_pass 127.0.0.1:8000; 
 include uwsgi_params; 
 } 
location /static { 
 autoindex on; 
 alias /home/daniel/myblog/static; 
 access_log off; 
 log_not_found off; 
} 
location /robots.txt { 
 alias /home/daniel/myblog/static; 
 access_log off; 
 log_not_found off; 
} 
location /favicon.ico { 
 alias /home/daniel/myblog/static/img; 
 access_log off; 
 log_not_found off; 
} 
 
}

至于部署方式可以采用,uWSGI,http://projects.unbit.it/downloads/。

tar zxvf uwsgi-latest.tar.gz 
cd uwsgi-1.2.6 
make 
cp uwsgi /usr/sbin/uwsgi

安装完uWSGI。

在你的工程目录下新建文件 django_wsgi.py

添加如下内容:

#!/usr/bin/env python 
# coding: utf-8 
import os,sys 
if not os.path.dirname(__file__) in sys.path[:1]: 
 sys.path.insert(0, os.path.dirname(__file__)) 
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' 
from django.core.handlers.wsgi import WSGIHandler 
application = WSGIHandler()

新建文件django.xml

添加如下内容,注意修改为自己的路径:

 
 127.0.0.1:8000 
 true 
 /home/daniel/myblog 
 .. 
 django_wsgi.py 
 true 
 

最后运行: wsgi -x wsgi.xml

这是 配置好了,在浏览器输入: http://localhost:8080/

是不是能够浏览你的站点了。

具体配置可参见我的工程里的相关配置

https://github.com/ustcdane/Mezzanine-uwsgi-nginx

文章转自: http://blog.csdn.net/daniel_ustc/article/details/8855303

文档

DjangoMezzanineuwsginginx配置

DjangoMezzanineuwsginginx配置:1, mezzanine介绍mezzanine就是一个基于Django框架的应用, 详细可以参考官方网站:http://mezzanine.jupo.org/2, Mezzanine 安装指南:# Install from PyPI $ pip install mezzanine # Create a project $ me
推荐度:
标签: 部署 nginx Django
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top