Skip to content

A basic Django setup that can be quickly cloned to PythonAnywhere and deployed with minimal setup

Notifications You must be signed in to change notification settings

robinbanbury/basic-django-website

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

basic-django-website

A list of things to do to get your website working on PythonAnywhere.com:

  • Clone the repo: git clone https://github.com/robincsmith/basic-django-website.git
  • Replace the contents of /var/www/<something>_com_wsgi.py with the following:
import os
import sys

 project_home = u'/home/<user>/<project_root>'
 if project_home not in sys.path:
     sys.path.append(project_home)

 os.environ['DJANGO_SETTINGS_MODULE'] = '<settings_folder>.settings'

 from django.core.wsgi import get_wsgi_application
 application = get_wsgi_application()

Where <user> is your username, <project_root> is the ROOT of the entire project and <settings_folder> is the folder that contains your settings.py

  • In the folder with your settings.py, open local_settings.py and provide your SECRET_KEY and ALLOWED_HOSTS. You can also configure the location and name of the log file here.
  • This project doesn't contain any database content, so some setup work is needed:
    • Migrate your databases (the models already exist): python manage.py migrate
    • Create an admin user: python manage.py createsuperuser
  • If you are importing database content (e.g an SQLite database named db.sqlite3), make sure the database file is in your settings.py folder
    • Ensure the following is in your settings.py, then run python manage.py syncdb (not tested):
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}
  • Reload your app in the PythonAnywhere UI, under the 'Web' tab.
  • If this were a private repository, we'd also need deploy keys to clone the repo, but it's not.

This has been adapted from PythonAnywhere's tutorial, available here

About

A basic Django setup that can be quickly cloned to PythonAnywhere and deployed with minimal setup

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published