Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to deploy Django project in CentOS

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces how to deploy the Django project in CentOS, the content is very detailed, interested friends can refer to, hope to be helpful to you.

Create a Django project

Now let's start creating the python project. Open the python Project Manager on the home page and click add Project. Fill in data: _ project name: custom line _ path: navigate to the path where the manage.py file is located _ Python version: select the python version corresponding to your project _ frame: select Django _ startup method: uswgi _ startup file / folder: navigate to the path where wsgi.py is located _ port: custom is fine. The _ check box after setting the 1024 port number depends on whether or not to install the module depends on the boot click to determine, and then wait for creation.

Set up the website service and configure the static file agent

The above operation has been started internally, and the next step is to set up the website service, provide external access, and set up the nginx agent to load static files.

Click "Mapping" in the python project manager to set the domain name (or public network IP).

After the mapping is successful, view it in the [website] menu in the panel sidebar. (it is now accessible externally. But there are no static files)

Click on the domain name or ip we have just mapped in the website, and a pop-up window will appear. Select reverse proxy-"profile."

Find a gap to add static files and media resource configuration.

About static files: the location where the css,js files are stored. Named after static in the django framework.

About media resources: for example, the location where users upload pictures, which is generally named media. Write whatever name you set.

Location / static/ {alias / www/wwwroot/myblog/static/;} location / media/ {alias / www/wwwroot/myblog/media/;}

According to the file path setting, only need to replace the red box, change to your path, the rest do not need to move.

On how to deploy the Django project in CentOS to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report