Nginx+uwsgi部署django应用
来源:互联网 发布:ai印花软件 编辑:程序博客网 时间:2024/06/05 21:13
Deploying Django
Django is very probably the most used Python web framework around. Deploying it is pretty easy (we continue our configuration with 4 processes with 2 threads each).
django或许是最好用的python web框架了。部署十分的简单(我们继续我们的4处理器双线程配置)
We suppose the Django project is in /home/foobar/myproject:
假设django项目目录是/home/foobar/myproject:
uwsgi --socket 127.0.0.1:3031 --chdir /home/foobar/myproject/ --wsgi-file myproject/wsgi.py --master --processes 4 --threads 2 --stats 127.0.0.1:9191
(with --chdir we move to a specific directory). In Django this is required to correctly load modules.
Argh! What the hell is this?! Yes, you’re right, you’re right... dealing with such long command lines is unpractical, foolish and error-prone. Never fear! uWSGI supports various configuration styles. In this quickstart we will use .ini files.
[uwsgi]socket = 127.0.0.1:3031chdir = /home/foobar/myproject/wsgi-file = myproject/wsgi.pyprocesses = 4threads = 2stats = 127.0.0.1:9191
A lot better!
Just run it:
uwsgi yourfile.ini
If the file /home/foobar/myproject/myproject/wsgi.py (or whatever you have called your project) does not exist, you are very probably using an old (< 1.4) version of Django. In such a case you need a little bit more configuration:
uwsgi --socket 127.0.0.1:3031 --chdir /home/foobar/myproject/ --pythonpath .. --env DJANGO_SETTINGS_MODULE=myproject.settings --module "django.core.handlers.wsgi:WSGIHandler()" --processes 4 --threads 2 --stats 127.0.0.1:9191
Or, using the .ini file:
[uwsgi]socket = 127.0.0.1:3031chdir = /home/foobar/myproject/pythonpath = ..env = DJANGO_SETTINGS_MODULE=myproject.settingsmodule = django.core.handlers.wsgi:WSGIHandler()processes = 4threads = 2stats = 127.0.0.1:9191
Older (< 1.4) Django releases need to set env, module and the pythonpath (.. allow us to reach themyproject.settings module).
- Nginx+uWSGI部署Django应用
- Nginx+uwsgi部署django应用
- nginx+uwsgi部署django应用
- Nginx+uwsgi部署django应用
- uWSGI+nginx部署python及django应用
- 使用nginx+uwsgi部署django应用
- django+nginx+uwsgi+service部署web应用
- Django+Nginx+uwsgi部署
- nginx uwsgi django部署
- nginx uwsgi 部署django
- django nginx+uwsgi部署
- Django+uWsgi+nginx部署
- Nginx+uWSGI+Django部署
- nginx+uwsgi部署django
- nginx+uwsgi部署django
- nginx+uwsgi 部署django
- Django nginx uwsgi部署
- uwsgi+django+nginx部署
- 为UIWebView实现离线浏览
- 生产单据号
- /dev/null 的用途
- 创建带有单选按钮的对话框
- 笔记99--自定义控件系列大结局三
- Nginx+uwsgi部署django应用
- 天猫浏览型应用的CDN静态化架构演变
- [转]Trie树优化算法:Double Array Trie 双数组Trie
- Permutation Sequence (Java)
- REQUIRE8 和 PRESERVE8 ---fwqlzz love is for ever
- JAVA抽象工厂模式
- ytu2776——小壮的习惯
- 如何创建渐变阴影,记一下,或许以后有用
- 【maven】-001用maven assembly插件打jar包实现依赖包归档