/
INSTALL
151 lines (105 loc) · 4.88 KB
/
INSTALL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
Installation
============
Molly is intended to be used with virtualenv and pip. However, before dealing
with the Python side of the installation you'll need to install the following
Debian packages or their equivalents for your distribution or OS:
* postgis
* python-gdal
* proj
* libgeos-3.0.0 or higher
* binutils
* libgdal1-1.5.0
* postgresql-8.3
* postgresql-8.3-postgis
* postgresql-server-dev-8.3
* python-virtualenv
* python-setuptools
* python-dev
* libxslt-dev
* libldap2-dev
* libsasl2-dev
postgis python-gdal proj libgeos-3.0.0 binutils libgdal1-1.5.0 postgresql-8.3 postgresql-8.3-postgis postgresql-server-dev-8.3 python-virtualenv python-setuptools python-dev libxslt-dev libldap2-dev libsasl2-dev
Unfortunately, pip isn't yet in Debian stable, so you'll need to install it
using easy_install:
$ aptitude install python-setuptools
$ easy_install pip
Next, set up and activate a virtualenv. This has been automated as
scripts/install_virtualenv.py. If you want to do this by hand, do the following:
$ virtualenv --no-site-packages ~/mollyenv
$ cd ~/mollyenv
$ source bin/activate
Next, clone the git repository to a temporary directory:
$ git clone git://github.com/mollyproject/mollyproject.git
Install the Molly dependencies and Molly itself:
$ cd ~/mollyenv/mollyproject/
$ pip -E ~/mollyenv/ install `cat requirements/core.txt` --upgrade
$ python setup.py install
Once you've set up the database as below, then you'll need to update the
secrets.py file in demos/molly_oxford to include your database details, etc.
Once you've done this, you'll need to build the media files for your site. Molly
uses compressed CSS and JavaScript in order to improve the performance on mobile
devices, but these need to be generated:
$ cd ~/mollyenv/mollyproject/demos/molly_oxford
$ python manage.py build_static --noinput
$ python manage.py synccompress
$ python manage.py generate_markers
You will also need to add any batch jobs you want to run into Molly:
$ PYTHONPATH=.. python manage.py create_crontab
This outputs text ready to be piped into crontab which sets up these batch jobs.
And now, you're ready to run your server!
$ python manage.py runserver
To get some initial data into Molly, you may want to run the batch jobs by hand.
This can be done by going into the administration interface:
http://localhost:8000/adm/
And then under batch processing, select 'Batches', and then select all the
batches in the screen and then from the Action drop down 'Run batch', and Go.
This will take some time, and when all the pending and currently running columns
are red, means that the job is complete. Clicking on each individual job then
shows the log for the last run, and if any errors have occurred, they will
appear here.
Database
--------
There are two ways to create the PostGIS template used by a molly installation:
* Run one of the scripts in scripts/ as the postgis user.
OR
* Follow the instructions at
http://geodjango.org/docs/install.html#creating-a-spatial-database-template-for-postgis
The first one is likely the simpler, but if it fails the latter will provide
more information to get it working.
Once this is done, you should create the molly database as a DB superuser
(e.g. as postgres) by executing the following:
$ createdb -T template_postgis molly
As a DB superuser, create the molly user:
(Make sure the password is the one given in settings.py in the demos folder)
$ createuser molly -P
Enter password for new role:
Enter it again:
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) n
Shall the new role be allowed to create more new roles? (y/n) n
Now edit pg_hba.conf (usually in /var/lib/pgsql/data) on Fedora systems, and
/etc/postgresql/8.3/main/ on Debian systems) to allow passworded logins from
the new user by adding the following line somewhere near the top.
local molly molly md5
Order is important, so it needs to go above any more general access directives.
Log in to the server as postgres and allow the user access to the database:
$ psql molly
Welcome to psql 8.3.7, the PostgreSQL interactive terminal.
Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit
molly=# grant all on database molly to molly;
GRANT
molly=# ^D
Either send SIGHUP or restart the server to reload pg_hba.conf
Change directory to your project directory and use manage.py to initialise the
database:
$ cd /path/to/molly/project/
$ python manage.py syncdb --all
$ python manage.py migrate --fake
It should ask you to create a new superuser. Say yes and set one up.
The site also requires a cache directory, currently /var/cache/molly .
Create this directory and give user www-data and/or your developer users/group
all permissions to do things to it.