In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article focuses on "how to configure the django environment", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to configure the django environment.
Environment description:
Ali Cloud ECS, Ubuntu, Nginx, Python3, Django, Supervisord
1. Update ubuntu to avoid later installation errors
Sudo apt updatesudo apt upgrade
Install and configure nginx
Apt-get install nginx
Create a project directory with a permission of 755
Mkdir / opt/web/venv/mysitechmod 755 web
Create VHost configuration create server configuration files such as myserver.conf under / etc/nginx/sites-available/
Note: the configuration file is suffixed with .conf
Create a soft connection
Ln-n / etc/nginx/sites-available/myserver.conf / etc/nginx/sites-enabled/myserver.conf
Add site information to the configuration file
Django
Server {listen 80; server_name www.mmfinding.cn mmfinding.cn; charset utf-8; client_max_body_size 75M; location / static {alias / opt/web/venv/mysite/collected_static;} location / {proxy_pass http://127.0.0.1:9001; proxy_set_header Host $host Proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;}}
3. Install python3-dev
Apt-get install python3-dev
4. Virtual environment
Install python3-venv
Apt-get install python3-venv
Generate a virtual environment in the specified current directory ('/ opt/web/venv')
Python3-m venv.
Enter the virtual environment
Source bin/activate
Exit the virtual environment
Deactivate
5. Use supervisor to manage processes
Installation
Apt-get install supervisor
Start the service
Supervisord-c / etc/supervisor/supervisord.conf
Check to see if supervisord is running
Ps aux | grep supervisord
Add process management (/ etc/supervisor/conf.d/mysite.conf)
[program:mysite] command=/opt/web/vevn/bin/gunicorn-- worker-class=gevent mysite.wsgi:application-b 127.0.0.1:9001directory=/opt/web/venv/mysiteuser=root here, I believe you have a deeper understanding of "how to configure the django environment". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.