Skip to content

Quickstart

chmarr edited this page Nov 24, 2012 · 22 revisions

Here's how to get started with artshow-jockey quickly, with little knowledge of Django. You'll still need to know the basics of your installation, a little bit about Python syntax, Apache configuration, and how to install packages or programs.

Django-1.4 now encourages a new project and application layout, and Artshow Jockey has been changed from it's original Django-1.3 layout to match. As such, we're able to provide a faster Quickstart by providing an example Django project. This Quickstart will use that example, but you're welcome to provide your own project and include the necessary settings to use the "artshow" Django application.

To facilitate this, we have renamed settings.py to common_settings.py, and created a local_settings.py.example for you to base a local_settings.py. You should only need to edit this latter file.

  • Ensure you have Python, at least version 2.5. If your default is 2.4, but have 2.5 installed, you'll need to wrangle headers of some .py files to ensure the right version runs, or run all python commands specifying "python26" (for example) explicitly.
  • Install the following python libraries:
  • Django version 1.4
  • South
  • Reportlab 2.5
  • pdfrw - from http://pdfrw.googlecode.com - needed to print bid sheets, but can be ignored if you don't need this feature
  • django-ajax-selects
  • Install the mod_wsgi Apache module. mod_wsgi is compiled against a specific python version. Make sure you're using the right version for the version of Python you want to run.
  • Obtain the Artshow Jockey files.
  • You can clone the git repository and use it straight from there:
git clone git://github.com/chmarr/artshow-jockey.git
  • You can download a Zip file, and unzip it:
curl -o artshow-jockey.zip https://nodeload.github.com/chmarr/artshow-jockey/zipball/master
unzip artshow-jockey.zip

In both cases a directory called "artshow-jockey" will be created. You can move or rename this to where you want. For the rest of these examples, this directory will be called PROJDIR. You should replace this with the full path name to that directory.

  • cd PROJDIR
  • mkdir data
  • Copy local_settings.py.example to local_settings.py, edit, and update the DATABASES and STATIC_ROOT variables to replace PROJDIR. Also update the ARTSHOW_* variables to your preferred settings.
  • ./manage.py syncdb This will create the database and ask a few questions. You definitely want to create the "auth" database.
  • ./manage.py migrate
  • ./manage.py loaddata artshowspaces artshowpaymenttypes
  • ./manage.py collectstatic
  • Create a configuration for apache. Eg: artshow.conf inside /etc/httpd/conf.d. Make sure you have the django path correct, and replace PROJDIR. Also replace USER with your username:
<VirtualHost *:80>
	ServerName myserver.example.com
	DocumentRoot /var/www/empty

	Alias /static/ PROJDIR/static/

	WSGIScriptAlias / PROJDIR/artshowjockey/wsgi.py
	WSGIDaemonProcess artshowjockey user=USER group=USER processes=3 threads=3 python-path=PROJDIR home=PROJDIR
</VirtualHost>
	
<Directory PROJDIR>
	WSGIProcessGroup artshowjockey
</Directory>
  • Restart apache to have it load the new settings.
  • Make sure you're still inside PROJDIR, then: touch artshowjockey/wsgy.py. This causes the wsgi service to reload all the python code. Do this after any changes to any .py file.

Trouble?

  • The instructions above assume you've created a user (here called "USER") to house the code and django settings files. If you've removed the "user" and "group" settings from the WSGI settings, it will still work but you'll need to worry about permissions
  • The process running the code needs to be able to write to the data directory and the file itself. sqlite3 creates additional files during its locking behaviour.
  • Also, if you've installed the code far away from the project directories, make sure the web server process can transit the links and read the code. A common mistake is not setting the execute bit on the directory, meaning a process can transit the directory albeit still not read it. chmod a+x DIRNAME will do the trick.
  • Make sure the /static/ alias in the apache configuration exists and points to the right place. (There are other ways of handling static files, but the instructions above work, and are simple)
  • If you've made any changes to .py files, don't forget to either touch django.wsgi. Restarting the web server also does the same job.
  • Python will save compiled files if able to. If not, it will figure it out. However, if problems persist, as a last resort try this:
cd PROJDIR
python -m compileall . peeps artshow artshow-utils
touch artshowproj/wsgi.py

If that actually fixes something, let me know.

Now What?

  • Visit http://myserver.example.com/admin/ and log in
  • Click "Spaces". Some spaces have been set up for you. Create/Delete/Edit to whatever is appropriate for your show.
  • Click "Artists" and start entering your artists.
  • Click "Email Templates" and create a template from the example. Use this to email one artist based on entered information and check that email sending works.
  • Bug Chris to create better documentation.

Tips?

  • sqlite3 is a file-based database. The file can simply be copied around if there's no transactions in progress: shut down the web server to ensure this. Live backups are also possible: consult the sqlite3 documentation.

Updates

Since you're obtaining your code through git, updates are easy to apply, but often require a few additional steps to ensure Django completely recognises the changes. It is adviseable to back up your installation prior to applying updates.

  • To retrieve updates, assuming you've cloned the git repository, run git pull inside PROJDIR.
  • If any changes to the database schema have been done, they will appear as changes inside a directory called migrations. To apply the schema changes, run ./manage.py migrate. It's safe to do this even if there are no changes.
  • If any changes to .py files have been made, force the running django processes to reload with touch artshowjockey/wsgi.py

Note that template changes are picked up automatically. .py changes inside of the migrations directory are not used by Django during runtime, so it is not necessary to touch the wsgi.py file. There is no harm in doing so, though.

Clone this wiki locally