Get the App
SLTechnology News&Howtos  ›  Development  › 

Steps for Django to install and run on Linux

Shulou Source: shulou.com Published: 2022-06-03 15:13:31 11月14日 Update

This article mainly introduces "the steps of Django installation and operation on Linux". In the daily operation, I believe that many people have doubts about the steps of installation and operation of Django on Linux. The editor has 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 of "Django installation and operation steps on Linux". Next, please follow the editor to study!

1. Install Python3.6.2 in Linux

Download address: https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tgz

Install related dependency packages:

Yum-y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

Go to the unzipped directory and specify the appropriate installation directory:

. / configure-- prefix=/usr/local/python3

Start the installation:

Make & & make install

Set the appropriate environment variables:

Export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/app/mysql/bin:/usr/local/python3/bin

2. Install the specified version of Django software through pip3

Installation commands:

Pip3 install django==1.11.11

Check to see if the installation is successful

[root@ops-site bin] # django-admin-- version

1.11.11

3. Create the first Django site

Go to the appropriate directory and create a testsite directory:

Django-admin startproject testsite

Edit the settings.py file and set the appropriate access permissions

ALLOWED_HOSTS = ['*']

Start the site

Nohup python3 manage.py runserver 10.3.152.78 8000 &

Note: nohup runs in the background, 10.3.152.78 (the IP address of the server), and 8000 is the startup port

At this point, the study on "the steps to install and run Django on Linux" 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!

Tags: Run step directory learn address more help practical successful next variable background command comment file article method server permission version Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Shulou Information Docker OPPO Reno Linux