This article will teach you how to deploy your Django project on Zeabur.
Before starting, please make sure you have installed Python on your computer, if not, please install Python environment (opens in a new tab).
Confirm whether there is a Python environment.
Open a terminal and execute the following command to install.
pip install django
Create a new Django project using the
django-admin command, replacing
project_name with your project name.
You can also use Django-template (opens in a new tab) After using the Django example, you can skip the second step.
django-admin startproject project_name
Open the Django project and execute the startup to check whether the local startup is successful.
cd project_name python manage.py runserver
To initialize a Git repository for it and deploy it to your GitHub, in your project, click the Deploy service or Add new service button and select Deploy your source code.
Launch the website success screen after the deployment is successful.
Please note that if an error occurs, please confirm whether there is configuration in the project:
- Check for
requirements.txt, the main purpose of this file is to list all the Python packages and their versions required by the project, It is used to ensure that the project has the same dependencies and versions in different development environments and production environments. If it is not configured, please use the following instructions in the project and push it to GitHub again.
pip freeze > requirements.txt
- Check whether
settings.pyis set, this property is a Python List, which contains the domains that can access the Django application, you can use
ALLOWED_HOSTS = ['*'], which means that all networks are allowed domain for testing purposes.