Section 7
Django
materials at jrsacher.github.io/web50
Outline
Project 1
Project 2
Project 3
A note on style
Django
Flask
Django
Installation: pip install Django
Creating a project
django-admin startproject <projectname>
projectName/
manage.py
projectName/
__init__.py
settings.py
urls.py
wsgi.py
(python scripts to run app)
(python packages)
(settings: ex: timezone, database)
(routing for entire project)
(for web deployment)
Slide: Elle Buellesbach
Applications
django-admin startapp <appname>
projectName/
manage.py
projectName/
__init__.py
settings.py
urls.py
wsgi.py
appName/
__init__.py
urls.py
view.py
models.py
AND OTHERS!
(the high level project controls)
(URLs will be routed through here first)
(an individual app within the project)
(Associating URLs with view functions)
(functions that run to create responses)
Slide: Elle Buellesbach
Convert a Flask app to Django
Protein identity matrix calculator from UniProt IDs
https://cadd-cdot.appspot.com/identity
Some test data:
P00533 P04626 P21860 Q15303
Can take a bit to run -- not optimized yet!
Not guaranteed to be up forever. On a public Google Cloud instance for development.
Django databases
python manage.py makemigrations
python manage.py migrate
Interacting with the DB
Django user forms