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
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
! ! ! A simpler way
Use the pagoda to directly deploy the django environment
Download the python project manager
The project moved to the database on the server
you want to export mysql data table structure sql file, upload it to the pagoda, and generate the database on the pagoda
pagoda Add database
upload a Django project, by default upload / www / wwwroot / directory
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.
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
be called in the global shell. The installation dependency requires the previously generated requirement.txt