> ## Documentation Index
> Fetch the complete documentation index at: https://kb.hosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Installing and configuring Django on unmanaged servers

> Install and configure Django on an unmanaged server with this step-by-step guide featuring detailed instructions and code snippets.

This article demonstrates how to install and configure Django on an unmanaged server.

## Installing Django

To install Django, you first create a virtual environment for Python by using the *virtualenv* tool. After you activate the virtual environment, you can use the *pip* installer to install Django.

To do this, follow these steps:

1. Log in to your server [using SSH](/docs/using-ssh-secure-shell).

2. As the root user, type the following commands appropriate for your Linux distribution:

   * Debian and Ubuntu:

     ```bash theme={null}
     apt-get install python3
     apt-get install python3-pip
     pip3 install virtualenv
     ```

   * AlmaLinux and Fedora:

     ```bash theme={null}
     yum install python34
     yum install python34-pip
     pip3 install virtualenv
     ```

3. As a regular (non-root) user, type the following commands:

   ```bash theme={null}
   cd ~
   mkdir django-apps
   cd django-apps
   virtualenv env
   source env/bin/activate
   pip install django
   ```

4. Django is now installed. To determine which version is installed, type the following command:

   ```bash theme={null}
   django-admin --version
   ```

## Configuring Django

Django is now installed, and you can create and configure a Django application. To do this, follow these steps:

1. As a regular (non-root) user, type the following command:

   ```bash theme={null}
   cd ~/django-apps
   django-admin startproject mysite
   ```

2. Use a text editor to open the */home/username/django-apps/mysite/mysite/settings.py* file. Replace ***username*** with the account username.

3. Confirm that debug mode is enabled:

   ```
   DEBUG = True
   ```

4. Locate the **ALLOWED\_HOSTS** line, and then modify it as follows. Replace ***xxx.xxx.xxx.xxx*** with the IP address of your server:

   ```
   ALLOWED_HOSTS = ['xxx.xxx.xxx.xxx']
   ```

5. Save your changes to the *settings.py* file.

6. To start the development web server, type the following command. Replace ***xxx.xxx.xxx.xxx*** with the IP address of your server:

   ```bash theme={null}
   python ~/django-apps/mysite/manage.py runserver xxx.xxx.xxx.xxx:8000
   ```

7. Use your web browser to visit *[http://xxx.xxx.xxx.xxx:8000](http://xxx.xxx.xxx.xxx:8000)*, where ***xxx.xxx.xxx.xxx*** is your server IP address. You should see the following message:

   ```
   The install worked successfully! Congratulations!
   ```

### Configuring the administration interface

Django includes an administration interface that you can use to modify web site applications, manage users and groups, and more. To configure the Django administration interface, follow these steps:

1. At the command prompt, type the following commands:

   ```bash theme={null}
   cd ~
   python ~/django-apps/mysite/manage.py migrate
   python ~/django-apps/mysite/manage.py createsuperuser
   ```

2. At the **Username** prompt, type the administrator username, and then press Enter.

3. At the **Email address** prompt, type the administrator e-mail address, and then press Enter.

4. At the **Password** and **Password (again)** prompts, type the administrator password, and then press Enter.

5. If the development web server is not running, type the following command. Replace ***xxx.xxx.xxx.xxx*** with the IP address of your server:

   ```bash theme={null}
   python ~/django-apps/mysite/manage.py runserver xxx.xxx.xxx.xxx:8000
   ```

6. Use your web browser to visit *[http://xxx.xxx.xxx.xxx:8000/admin](http://xxx.xxx.xxx.xxx:8000/admin)*, where ***xxx.xxx.xxx.xxx*** is your server IP address.

7. Log in to the administration interface using the username and password that you specified in steps 2 and 4.

## More information

Now that you have a Django-enabled web site up and running, you can start the real work of developing your own applications. The following resources can help:

* To view the official Django documentation, please visit [http://docs.djangoproject.com](https://docs.djangoproject.com).

* For information about Django extensions, please visit [https://github.com/django-extensions/django-extensions](https://github.com/django-extensions/django-extensions).

## Related articles

* [Python script basics](/docs/python-script-basics)

* [Using virtualenv and pip](/docs/using-virtualenv-and-pip)
