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 the Django project to the server

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly introduces "how to deploy the Django project to the server". In the daily operation, I believe that many people have doubts about how to deploy the Django project to the server. The editor consulted all kinds of materials and sorted out a simple and easy-to-use method of operation. I hope it will be helpful to answer the doubt of "how to deploy the Django project to the server". Next, please follow the editor to study!

Screenshot of Django official website

What is Django?

Django is an open source Web application framework based on Python. The Django framework not only provides a complete code directory structure, but also uses the structure of Model, View, and Template, which makes the code easy to be standardized in the development process. Among them, Django Admin provides an out-of-the-box background management system and is loved by many Python developers and startups.

21 Cloud Box provides a very simple Django deployment method, and you can deploy it in a Python environment on 21 Cloud Box.

How to deploy?

Register as a 21 Cloud Box member

Create a PostgreSQL database

Fork django example

Create a cloud service on 21 cloud boxes and allow 21 cloud boxes to access your code base

Configure the following settings

Environment

PYTHON 3.7

Build commands:

. / build.sh

Start the command:

Gunicorn hello.wsgi:application

Point advanced configuration for environment variable configuration:

KEYVALUEDJANGO_DB_URL acquires DJANGO_ALLOWED_HOSTS.21yunbox.com,127.0.0.1 from the midpoint database URL in the first step of creating a cloud database

For more Django-related configurations, please refer to the official documentation. In this example, DJANGO_DEBUG=True is for demonstration only. When you actually go online, you can set DJANGO_DEBUG to False in the environment variable.

When the construction is complete, the Django administrator account can be created using the remote connection of the 21 Cloud Box.

. / manage.py createsuperuser

It's that easy! When the build is complete, your application will be accessible in the subdomain name of the 21 Cloud Box.

If the description of the above description is not clear, you can refer to the following practical video: https://www.bilibili.com/video/BV1Br4y1c7C4

Why choose 21 Cloud Box?

OPS-free and out-of-the-box cloud services are basically not available in China. If you are looking for a cloud service platform like Heroku or Nelify, 21 Cloud Box is still in operation and is the closest.

What is the difference between 21 Cloud Box and these foreign cloud service platforms? Please refer to:

21 Cloud Box vs Heroku

21 Cloud Box vs Netlify

21 Cloud Box vs Vercel

21 Cloud Box vs Gatsby Cloud

21 Cloud Box vs Github Pages

21 Cloud Box vs Surge.sh

Comparison in terms of function and price: 21 cloud boxes vs Heroku, Netlify, Vercel

At this point, the study on "how to deploy the Django project to the server" 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!

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

Servers

Wechat

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

12
Report