The secret to what makes playdoh fun is the funfactory module. When you install funfactory from PyPI or from source you get a command line script that you can use to start a new playdoh project. Install funfactory with a package manager like pip:
pip install funfactory
You’ll now have the Playdoh installer script. Read through funfactory --help or start a new project like this:
funfactory --python=python2.6 --pkg=yourapp
The automatic install process goes like this:
If a virtualenv needs to be created and you have virtualenvwrapper installed, the created virtualenv will go in your WORKON_HOME directory. Otherwise the virtualenv will be installed in .virtualenv.
The Playdoh project layout uses a vendor library, i.e. a subdirectory vendor that contains all pure Python libraries required. In addition, a few C based libraries (such as MySQL-python, bcrypt, etc) get built by the installer. For more information on vendor libraries, read pip and friends: Packaging.
By default the funfactory installer configures your app to use a MySQL database named playdoh_app. You’ll need to create the database manually:
mysql -u root -e 'create database playdoh_app;'
If you need to adjust any settings for the database connection, edit yourproject/settings/local.py. Synchronize tables and initial data:
Start the development server:
./manage.py runserver 0.0.0.0:8000
You can now view the dev server at http://localhost:8000/ – hooray!
If you start adding pieces that should go back into playdoh, you will probably want to patch funfactory, which is the core of Playdoh.
If your app’s configuration requires you to add or remove apps, middleware, or template context processors from the default funfactory configuration, you can use the get_apps, get_middleware, and get_context_processors functions. See the settings management API documentation.
The installer script automates everything you’d need to do by hand but it’s simple to do it yourself. Here’s what you would do:
Then you should be ready to run syncdb and start up the server:
./manage.py syncdb ./manage.py runserver 0.0.0.0:8000