In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "how to deploy and configure the python django framework". In the daily operation, I believe many people have doubts about how to deploy and configure the python django framework. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "how to deploy and configure the python django framework". Next, please follow the editor to study!
# Environment ubuntu server 14.04
# nginx + uwsgi + django + virtualenv
# assume the project directory: / home/jack/django_web/mysite_bootstrap
1 configure virtualenv
Workon py_env1
2 install django uwsgi
Pip install django
Pip install uwsgi
3 Test uwsgi
Cd / home/jack/django_web/mysite_bootstrap
Vi test.py
Def application (env, start_response):
Start_response ('200OK', [(' Content-Type', 'text/html')])
Return "Hello World"
Start uwsgi
Uwsgi-- http 192.168.56.121 wsgi-file test.py
Local browser input http://192.168.56.121:8001 test
4 configure uwsgi
Vi django_wsgi.py
Import os
Import sys
Reload (sys)
Sys.setdefaultencoding ('utf8')
Os.environ.setdefault ("DJANGO_SETTINGS_MODULE", "mysite.settings")
From django.core.handlers.wsgi import WSGIHandler
Application = WSGIHandler ()
# Test uwsgi and django integration
Uwsgi-- http 192.168.56.121 chdir. -- module django_wsgi
Local browser input http://192.168.56.121:8001 test
5 create a uwsgi profile for deployment
Vi django.xml
: 8081
.
Django_wsgi
one
Uwsgi.log
6 install nginx
Sudo apt-get install nginx
7 configure nginx
Vi / etc/nginx/conf.d/nginx-bs.conf
# bootstrap nginx conf
Upstream django {
Server 127.0.0.1:8081
}
Server {
Listen 80
Server_name demo.django.com 192.168.56.121
Location / {
Uwsgi_pass django
Include uwsgi_params
}
Location / static {
Alias / home/jack/django_web/mysite_bootstrap
Index index.html index.htm
}
}
9 start
Cd / home/jack/django_web/mysite_bootstrap
Uwsgi-x diango.xml
Sudo service nginx restart
# browser input http://192.168.56.121/ test
At this point, the study on "how to deploy and configure the python django framework" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.