Action disabled: source

Python & Django Information

This article contains information about setting up a Python web application with BYU Domains. These instructions are NOT guaranteed to work, but some users have had success from following them for Django applications. Similar principles may be necessary for other Python-based web applications.

Using Python Scripts in BYU Domains

If a user wants to use Python with BYU Domains, essentially it's just a matter of using htaccess to tell the Apache server that you're serving up files that are actually scripts meant to be executed.

Users will need to include a “—user” argument when they install a package for it to work, (e.g., “pip install—user pandas” or “pip install pandas”).

Here's a guide to working with Python on the server:


Django is a high-level Python Web framework that helps you with rapid development and clean, pragmatic design. Built by experienced developers, it takes care of much of the hassle of web development so you can focus on writing your app without needing to reinvent the wheel.

Note: Try reinstalling Python when all else fails (this has been known to solve issues when the user receives errors).

Information about Django is given as a use case example.

As stated above, several users have had success following the example Django instructions, but they are not guaranteed to work for all users since software versions and preferences for organizing the file system may differ.

The cPanel has the ability to set up Python-based web applications in a virtual environment.

1. Go to the section titled Software in BYU domains and click on “Setup Python App.”

2. Select the version of Python to be used, choose a directory for public and temporary files of the app, select the proper App domain/URI for the app in the dropdown menu, and then click “Setup” to create a new app.

3. Select the necessary modules for the application. Next to modules, click show, then enter the name of the module. Click add, then repeat for more modules if necessary. For example, a Django app will require the Django module and the flup module.

4. A command to enter the virtual environment will be generated automatically on the page. Copy and paste the command text into the Execute Command field (watch out for whitespace). Click Run to execute the command. This command could be entered through an SSH connection to the server if preferred.

5. It may be necessary to execute other commands to start a project. To start a Django project, enter the command “django-admin startproject <YOURPROJECTNAME>” in the Execute Command field or command line through SSH.

6. Certain adaptations to file paths, or the Web Server Gateway Interface, may be preferred or necessary at this point. For example, to make sure Django is functioning properly, go to the directory where your app was created in step 1. Find the file and replace the existing text with the following:

 import sys, os
 sys.path.insert(0, "/home/USERNAME/YOURPROJECTNAME")
 from PROJECTNAME.wsgi import application
 from flup.server.fcgi import WSGIServer
       if __name__ == '__main__':

At this point, you should be able to see a message indicating that Django is functioning on that page.