The road to WeChat applet development (10) Django deployment server & WeChat applet’s first calculator project construction

Django Nginx+uwsgi installation configuration (complex, simple method is below)

In the previous section, we used python manage.py runserver to run the server. This only applies to use in a test environment.
For the officially released service, we need a stable and continuous server, such as apache, Nginx, lighttpd, etc. This blogger will take Nginx as an example.
Download python3.8 and django (for the download process, please see the article "Centos Build a Python3.8 Environment")
Install uwsgi

pip install uwsgi

Insert picture description here
Install Nginx

cd ~
wget http://nginx.org/download/nginx-1.5.6.tar.gz
tar xf nginx-1.5.6.tar.gz
cd nginx-1.5.6
./configure --prefix=/usr/local/nginx-1.5.6 \
--with-http_stub_status_module \
--with-http_gzip_static_module
make && make install

Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here

! ! ! A simpler way
Use the pagoda to directly deploy the django environment
Download the python project manager
Insert picture description here

Insert picture description here
Insert picture description here
The project moved to the database on the server
Insert picture description here
you want to export mysql data table structure sql file, upload it to the pagoda, and generate the database on the pagoda
Insert picture description here
Insert picture description here
pagoda Add database
Insert picture description here
upload a Django project, by default upload / www / wwwroot / directory
Insert picture description here
upload is complete Change debug to False in settings.py, and the database is configured to the database name and password you just recorded, which can be edited directly in the pagoda panel.
Insert picture description here
Insert picture description here

Open the installed python project manager in the pagoda, install the required python version in the version management, I used 3.8.1, note: the python version installed by the python project manager and various dependent modules are It is in a virtual environment that cannot
Insert picture description here
be called in the global shell. The installation dependency requires the previously generated requirement.txt
Insert picture description here

Guess you like

Origin blog.csdn.net/xulei1132562/article/details/113656461