How to deploy a django project on Reg.ru
16.03.2025
15.04.2025
4 minutes
128
0
0
0
0
Introduction
In this article, which will be the final one for the series of articles about the search results scraper. I will show you how to deploy a site on Django, the frontend of which is written in React, on servers from the hosting provider reg.ru. I will start with the fact that you should already be registered and have paid hosting and a domain name. Everything, of course, from the hosting provider, reg.ru. I want to note that they have a very beautiful design of the admin panel and personal account.
Setting up hosting platform
After purchasing the hosting service and domain name, you will need to go to the hosting from the main page.

Then go to the control panel (computer icon)

Next, you will need to go to all sites on the dashboard (1), select the appropriate site (2) and click the change parameters button (3).

Now, about what levers and buttons you will definitely need to press. To be more specific, this means choosing the required version of Python and toggle CGI scripts on.

I want to note that if your django site is written on versions higher than 4.2, then for you (just like for me) only one version of python will do, 3.10.1. Also, if you also bought an SSL certificate, include it too.
We have completed the basic hosting setup. And unlike the beget hosting provider, we won’t need to manually download and install the required version of Python and OpenSSL.
Publishing the website
Deploying a website always starts with transferring its files. They can be transferred in two ways, either through the control panel or using the scp command, through the terminal. Here I will consider only the first method, because it is stupidly simpler.
First, go to the file manager, after which you will need to go to the directory under the name of the domain name you bought. In my case, this is search-result-parser.site. All such directories are located in the www directory.

Let's download the archive with the site files and unpack it there accordingly. I'll give you the finished version of the site. There will be already files with dependencies, scripts, and settings. Just download it.
Setting up static and media files
In order for the server to be able to access our files, they must all be in the root directory of the site, that is, in my case, /www/search-result-parser.site/. You will need to change the following lines in the settings.py file to:
That's it.
Setting up database
To get a minimally working site, you only need to set up a database. SQLite is certainly not suitable for these purposes. You need to switch to the database that is supported by the server itself. In the case of reg.ru, this is MySQL.
You will need to replace the following lines in settings.py:
But that's not all. Right now, we're interested in the following keys in the dictionary:
- NAME - Database name
- USER - Database user name
- PASSWORD - Database password
All other values remain as I specified them. How do I find the values for them?
Go to the databases on the dashboard, create a database. By default, you'll already have a new database created. You can use it, but I'll show you how to create your own.

Fill in the required fields. You can also create a separate user for the database or use an existing one.

Now the database is successfully configured for work too.
"Install" the website
Now let's install the site, so to speak. By installation, I mean copying all static files, creating migrations for the database and writing additional scripts for layers between our site and the server itself.
In the root directory of the site, create a virtual environment, activate it and install the necessary packages via pip:
I want to note that if you need to use python3.10, you will have to specify the full path to the interpreter, because it is not in the environment variable $PATH. Keep this in mind.
Now we will transfer all static files, create migrations for the database, and also compile translations.
All static files will be moved to /www/search-result-parser.site/ (All media files will be there too). All necessary tables will also be created, just like files with translations.
The last and final step in "installing" the site will be creating a passenger-wsgi.py script with the following content.
Where instead of sys.path.insert(0, ..., you will have to specify the path to the root folder of your django site.
Where instead of sys.path.insert(1, ..., you will have to specify your path to the packages in the virtual environment created earlier.
Server reload
Now restart the server by creating a file .restart-app in the root directory of the site, /www/search-result-parser.site/. The servers work in such a way that every minute they check the hostings for the presence of such a file and if it is there, they restart it.
Conclusion
In this way, you can now deploy a site written in django yourself. I will say right away, in comparison with the hosting provider from beget, installation on reg.ru is much simpler and more user-friendly. And now my site about parsing search results is available to all of you. \^o^/
Comments
(0)
Send
It's empty now. Be the first (o゚v゚)ノ
Other
Similar articles
Used termins
- VPS (Virtual private server) ⟶ This is a service whose essence is that access to a dedicated server on a specific machine is provided. There can be thousands of such dedicated servers on one machine. Typically, managing such a server is no different from managing a regular, physical one.
- Website builder ⟶ It is an app or web service, with a collection of ready for use templates and tools, for constructing a website.
- Hosting ⟶ It is a service for providing space on a server and allocating predetermined resources to this server, with the condition that this server has permanent access to the Internet.
- Virtual environment ⟶ Is a self-contained directory that provides a way to manage dependencies and isolate project-specific configurations in Python (and other programming languages). It allows developers to create a separate environment for each project, ensuring that each project can have its own dependencies, regardless of what dependencies every other project has.
- Website ⟶ Is defined as a collection of related web pages that are typically identified by a common domain name and published on at least one web server. Websites can serve various purposes and can include anything from personal blogs to business sites, e-commerce platforms, or informational resources.
Related questions
- What did you do before becoming a webmaster? I made games and wrote my own game engine. I made 5 games and released only one on the Play Store. And the engine was called **DI.** I abandoned it
- Why did you choose django over website builders ? Quite a difficult question. I guess I like to understand and delve into complex things, although it seems that it’s not worth it. It's a similar story with game development. Instead of making games using game engines, I made my own, **DI**. Well, I'm just not looking for easy ways ;)
- Name some ways to reduce a website’s loading time ? Here are some ways of reducing a site’s loading time: 1) Find a performance-optimized hosting solution. 2) Compress images and other visual content 3) Reduce URL redirection 4) Place JavaScript and CSS files in external storage 5) Invest in a content delivery network (CDN) 6) Remove unnecessary software additions