Skip to content
Django For Everybody Sample Code
Python HTML
Branch: master
Clone or download
Latest commit e8af4ad Nov 18, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
authz Update Sep 29, 2019
autos Updates for clarity Nov 5, 2019
bookmany Clean up migrations Sep 20, 2019
bookone Clean up migrations Sep 20, 2019
crispy Update samples Nov 8, 2019
dj4e-samples Updates Nov 18, 2019
favs Clean up migrations Sep 20, 2019
favsql
form Tweaks Oct 2, 2019
forums Updates Nov 8, 2019
getpost MVP html54 and html5 Oct 1, 2019
gview Updates Sep 24, 2019
hello WOAH! Move "samples" up. Apr 23, 2019
home Revert back to bootstrap 3 Nov 18, 2019
jscr
many Add a header and cope Oct 4, 2019
menu WOAH! Move "samples" up. Apr 23, 2019
myarts Use reverse instead of reverse_lazy whenever possible Sep 29, 2019
pics Remove the Create / Update combo Nov 9, 2019
rest Clean up migrations Sep 20, 2019
route Use reverse instead of reverse_lazy whenever possible Sep 29, 2019
scripts Add a header and cope Oct 4, 2019
session Typoes Sep 29, 2019
tmpl
tracks Clean up migrations Sep 20, 2019
usermodel Updates Nov 18, 2019
users Clean up migrations Sep 20, 2019
views Update redirect Sep 24, 2019
.gitignore Cleanup Mar 22, 2019
LICENSE.md Ya - add a license Jan 22, 2019
README.md Changes Sep 28, 2019
manage.py WOAH! Move "samples" up. Apr 23, 2019
requirements.txt WOAH! Move "samples" up. Apr 23, 2019

README.md

DJ4E Samples

This is a set of Django projects that provide free sample code to support the www.dj4e.com web site.

You can see some of the samples working at

http://samples.dj4e.com

To set this up, go into your virtual environment if needed, and then check this out into some folder:

cd ...wherever...
git clone https://github.com/csev/dj4e-samples.git
cd dj4e-samples
pip3 install -r requirements.txt
python3 manage.py migrate
python3 manage.py createsuperuser --username dj4e-samples
# python3 manage.py changepassword dj4e-samples
# dj4e_nn_!
python3 manage.py runscript gview_load
python3 manage.py runscript many_load

These samples may be updated from time to time so you might want to get updates using git pull. Also if there are bugs, you are welcome to submit a Pull Request on github.

All of the documentation material is copyright CC-BY 3.0 and the code is copyright MIT by whomever wrote the code or documentation. You are welcome to use this in any way you see fit and paste code from this repo into your applications.

Running Locally

If you have Django installed on your local computer you can test any of the sample applications by going into the folder and starting the server:

cd dj4e-samples
python3 manage.py runserver

And visit http://localhost:8000.

Running on PythonAnywhere

Once you have checked out the code under django_projects, and ran the migrations and load scripts, go under the Web tab, update the config files to point to your new application:

Source code:                /home/--your-account--/django_projects/dj4e-samples
Working Directory:          /home/--your-account--/django_projects/dj4e-samples

Use this as your WGSI configuration file:

import os
import sys

path = os.path.expanduser('~/django_projects/dj4e-samples')
if path not in sys.path:
    sys.path.insert(0, path)
os.environ['DJANGO_SETTINGS_MODULE'] = 'dj4e-samples.settings'
from django.core.wsgi import get_wsgi_application
from django.contrib.staticfiles.handlers import StaticFilesHandler
application = StaticFilesHandler(get_wsgi_application())

You can edit these files and settings in the Web tab to switch between your various projects on PythonAnywhere. Make sure to reload under the Web tab after every file or configuration change.

You can’t perform that action at this time.