Here are some guidelines for how to structure Django apps to fit the GeoCam conventions.
We chose to base our design off the django-app-skeleton app generator.
geocamAwesome/
README.rst
-- what is this app? what does it do? in wiki-like reStructuredText formatsetup.py
--setuptools
, probably with some custom commands to do cool stuff.geocamAwesome/
- Django code (models, views, etc)
templates
,templatetags
media/geocamAwesome
images
,css
,javascript
[should we split this up into further subdirs?]tests
bin/
-- other things which don't belong with the web code, but need to be run or interact with the app. Also, misc utilities.doc_src/
-- rst files for documentation about the app (For automatic, sexy, html documentation generation. Yes. Sexy.)LICENSE-2.0
- the Apache 2.0 licenseMANIFEST.in
-- setuptools file. ignore.
Now that you know what one looks like, know that you don't have to make it yourself! An app generator has been created to make the magic happen. Let's take the fictional app of geocamAwesome
. You can create this bag of awesome-sauce in 5 easy steps:
Create the
geocamAwesomeWeb
repository. On GitHub, you do this by clicking onDashboard
, thenNew Repository
.Clone your master repo locally:
git clone git@github.com:$GITHUBUSER/geocamAwesomeWeb.git
Clone the GeoCam Django app generator from GitHub. (It doesn't matter where you put it, you will only need the generator to create your app, then you can get rid of it.):
git clone https://github.com/geocam/geocamDjangoAppSkeleton.git
cd to the parent directory of your
geocamAwesomeWeb
checkout and fill in your blank repo by running:geocamDjangoAppSkeleton/create_app.py
At the prompts, you want the app name to begeocamAwesomeWeb
and the package name to begeocamAwesome
. The author should beGeoCam Project
.
- Profit!
Don't forget to commit the newly created little files of joy to the geocamAwesome git repo!
Overall, we are dealing with a server that will be comprised of a bunch of Django applications. These apps need to be put into one cohesive Django site that makes sense for the responders we are supporting. Structuring the Django apps in a consistent manner makes it easier to create the site in a standard way, but we still need to define the glue code.
geocamSite/
siteSettings.py
-- default site settings, may override app-default settingssettings.py
-- this checkout's local, overridden settings. (db setup, etc)geocamApp1
--(symlink)--> submodules/geocamApp1/geocamApp1geocamApp2
--(symlink)--> submodules/geocamApp2/geocamApp2submodules/
geocamApp1/
-- submodule repogeocamApp2
-- submodule repoREADME.rst
-- what is this repo? in wiki-like reStructuredText formatsetup.py
--setuptools
Python file (will probably setup the symlinks, etc)
There is to skeleton generation for sites yet, sorry!