This article will show you how to run an automatic installation script to set up Django in a Python virtual environment within a WebApps project.
If you do not have a WebApps section in your hosting Control Panel, then this tutorial is not suitable for your particular hosting environment. You can submit a support ticket through our ticketing system if you need assistance.
We will set up a Django production environment. We will use Python 3, pip 3, Django 5, Python's MySQL client (mysqlclient), and uWSGI
in order to provide you with the tools necessary for running web applications with Django.
Prerequisites:
Both of these actions can be performed through the SSH Access section of the hosting account's Control Panel.
To start, you first need to create a directory for your Django project. You can create the directory using the File Manager in your hosting Control Panel. This directory needs to be created under the /private directory on your account. In this example, we will create a subdirectory called "django".
To use MySQL with your Django application, you need to create a new MySQL 8 database and user via the MySQL Databases > MySQL 8 section in your hosting Control Panel. The installation script will later prompt you to enter the MySQL 8 database name, username, and password.
Next, you need to create an app for your Django project. Running Django as a web app allows the application supervisor on the server to manage the application. You can create an app for Django using the WebApps section of the hosting Control Panel as follows:
It is now time to run the automatic installation script. To do so, follow these steps:
bash <(GET https://tickets.suresupport.com/faq_img/7919.sh)
The installation script generates a default project template. The Admin interface is accessible at /admin (e.g. https://www.mydomain.com/admin).
6. Debug Mode
The default Django settings.py file is created with "
DEBUG = True" for convenience. For a production environment, the DEBUG mode should be disabled. To do so, you need to edit the ~/private/django/myproject/myproject/settings.py file. Find the following line:
DEBUG = True
and change it to:
DEBUG = False
Then, stop the app and start it again. Note that if you have not created a home page, a "Not Found" error will show up when you open the URL of the Django installation.
All prices are in USD. No setup fees. Minimum contract period for shared hosting services - 12 months. Full prepayment for the contract period. 100-day money-back guarantee. No automatic renewal. Fees for domain registrations and SSL certificates cannot be refunded in case of an early contract termination.
ICDSoft 2001-2025 © All rights reserved
Terms of Use
|
Legal notice
|
Privacy
|
Reseller terms
|
Cookies