+380 (44) 391 0955
Call me
support@tuthost.ua
24/7 email support
Live chat (10:00-19:00)
Chat

How do I install Django on my hosting?

Django is a popular framework for developing websites and web applications. In this tutorial we will tell you how you can install it on your hosting.

  1. Go to the Setup Python App menu item
  2. Click the Create Application button
  3. Enter the name of the directory where Django will be installed, starting with the domain folder. There is no need to put a slash at the beginning and at the end of the path. We recommend that you place the application in a folder with your domain name, on the same level as the public_html folder, but not inside it.
    Do not fill in the fields: “Application launch file” and “Application entry point”.
    Specify the path to the log file, note that part of the path is already prescribed. We recommend placing logs in the logs folderHow do I install Django on my hosting?
  4. After creating the application – go to it and copy the link to enter the virtual environment
    How do I install Django on my hosting?
  5. Go to the Directadmin home page and go to Web SSH Client. If you do not have this option – write a request to support to activate it. SSH access is granted only to clients who have been fully verified.
  6. In the SSH console, enter your login and password (the same as for Directadmin).
    Enter the command to log in to the virtual environment that you copied earlier. For example, a command might look like this:
    source /home/username/virtualenv/domains/example.com/django/3.8/bin/activate && cd /home/username/domains/example.com/django
    To install Django, enter the command:
    pip install django
    To create a new Django project, enter the command:
    django-admin startproject myapp ~/domains/example.com/django
    Where myapp is the name of your application, example.com/django – the name of the domain and folder where you created the Python application.
  7. Now you need to make settings in the file settings.py. For our example, it will be available in the ~/domains/example.com/django/myapp/settings.py folder
    In this file, in the variable ALLOWED_HOSTS = [‘example.com’, ‘www.example.com’] – enter your domain, which should open the site.
  8. Copy the contents of the wsgi.py file intopassenger_wsgi .py.
    For
    our example:
    cp ~/domains/example.com/django/myapp/wsgi.py ~/domains/example.com/django/passenger_wsgi.py
  9. And the last step is to run the command in order to perform the migration:
    python ~/domains/example.com/django/manage.py migrate
    After that you can start configuring and populating your Django site

 Hosting
Total 0 Votes:
0

Tell us how can we improve this post?

+ = Verify Human or Spambot ?