More Tutorials on Web Development
Finally, it’s time to deploy our project. Instead of doing everything manually, we use a server management panel, which is much more beginner-friendly.
Setup a VPS
First, let’s setup a new VPS by following this tutorial.
Now, you have two choices, you can either follow this tutorial and use a control panel to deploy our project, or you can do it manually.
The control panel method does not guarantee success, I choose to introduce it here because it is a lot easier for beginners. So if it does not work for you, please refer to this article and deploy it manually.
Install a Control Panel For Your Server
There is a lot you can choose from. Here I’ll use aaPanel as an example.
After the installation process is finished. Follow the instructions on the screen and log into the panel.
From now on, everything should be straightforward. Just install the latest version of the Apache server and Python. You can install MySQL if you want. It is more robust and secure. But if you don’t, Django will use SQLite by default. You can also install other tools, but for now, these are all we need.
Deploy Your Django Project
I tested this tool on my own server and it worked for me. However, since it is still under development, there is a chance that it won’t work for you. In that case, please refer to this post on how to deploy Django project manually.
First, go to “Files”, and create a new directory.
After that, upload your entire project, not including “venv”, to the folder you just created.
Next, open the Python Manager and add a new project.
“Path” should point to the dir that contains
manage.py. “Version” is the version of Python that you installed.
The startup module is can be either
uwsgi. They are both interfaces that allow Django and the webserver to communicate.
gunicorn did not work for me, so maybe you should try
The startup dir should point to the folder that contains
wsgi.py. And finally, the “Port” can be anything you want. Once you click confirm, it will take a few minutes to install all dependencies.
Finally, map the domain to the server and we are good to go! Assuming you already have one, if not, you can register a new domain name at NameCheap.