dojango-sample
dojango-sample copied to clipboard
A sample application how to use dojango with other reusable apps
dojango-sample
A sample application how to use dojango in combination with other reusable apps.
The following apps are used:
-
dojango: https://dojango.googlecode.com/svn/trunk/dojango: Used for integrating the Dojo Toolkit
-
sandoval: http://github.com/streetcleaner/sandoval: We use this app for having a model and data, we want to show
-
django-uni-form: http://github.com/pydanny/django-uni-form For better and easier form displaying.
-
django-treebeard: http://code.tabo.pe/django-treebeard/ Used for showing the capabilities of the TreeStore.
-
django-piston: http://bitbucket.org/jespern/django-piston For creating our own JSON-Rest-API that is used in conjunction with the models from sandoval.
Installation:
It is required, that you have installed Python >= 2.5, Django >= 1.1 and PIL (Python Imaging Library) before!
-
Installing used reusable apps
-
Creating the database
-
Loading data into the database
-
Copying image data to an accessible place
-
Starting the server and see it in action
-
Installation of reusable apps
For this installation you need to install SVN, GIT and MERCURIAL before. Alternatively you can download the various packages directly from the above mentioned websites and place them within the "external_apps" directory.
cd [dojango-sample-dir] cd external_apps svn export https://dojango.googlecode.com/svn/trunk/dojango svn export http://django-tagging.googlecode.com/svn/trunk/tagging git clone git://github.com/pydanny/django-uni-form.git ln -s django-uni-form/uni_form . git clone git://github.com/streetcleaner/sandoval.git ln -s sandoval/movie . hg clone http://code.tabo.pe/django-treebeard/ ln -s django-treebeard/treebeard . hg clone http://bitbucket.org/jespern/django-piston ln -s django-piston/piston .
- Creating the database
cd [dojango-sample-dir] python manage.py syncdb
Just enter the requested information for creating an initial django user.
- Loading data
cd [dojango-sample-dir] python manage.py loaddata post # loading sample-data for the tree python manage.py loaddata movies # loading some sample movies python manage.py loaddata feeds # loading some information, where to get new movies from
- Copy image data
cd [dojango-sample-dir] tar xzvf external_apps/movie/fixtures/images.tar.gz
- Start the server
cd [dojango-sample-dir] python manage.py runserver
This starts the internal django development server and the application will then be available from here:
http://localhost:8000
Enjoy!
Play with dojango
For further details visit: http://code.google.com/p/dojango/wiki/DojoBuild
Doing a Dojo build
-
Get a dojo source release
-
Do a dojo build
-
Enable that build for your dojango project
-
Get a dojo source release
This is fairly simple, because downloading a specific version of Dojo is integrated into manage.py:
cd [dojango-sample-dir] python manage.py dojoload
Starts a dojo download of the version, that was defined within DOJANGO_DOJO_VERSION (should default to the latest) and places it into:
[dojango-sample-dir]/dojo-media/src/[DOJANGO_DOJO_VERSION]
Of course you now can develop your project using the Dojo source release by enabling it in your settings.py:
DOJANGO_DOJO_PROFILE = "local"
defaults to the latest version, but can be any version
that is available within src-folder
DOJANGO_DOJO_VERSION = "1.4.0"
- Doing a dojo build
Also the starting of a dojo build is integrated into manage.py and this project has an already setupped build profile defined, so you just have to call:
cd [dojango-sample-dir] python manage.py dojobuild
Afterwards there will be built version here:
[dojango-sample-dir]/dojo-media/release/[DOJANGO_DOJO_BUILD_VERSION]-dojango-with-dojo
- Enabling that build
After the build you are able to switch the Dojo environment of your whole project to it. For that you just have to manipulate your [dojango-sample-dir]/settings.py:
DOJANGO_DOJO_PROFILE = "local_release" DOJANGO_DOJO_VERSION = "[DOJANGO_DOJO_BUILD_VERSION]-dojango-with-dojo"
If you now reload the initial page on http://localhost:8000 it will require less JavaScript files.