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
|
=============================
Development environment setup
=============================
Getting started
===============
1. Install system dependencies
::
sudo xargs apt-get install -y < dependencies.txt
sudo xargs apt-get install -y < dependencies-devel.txt (only used for dev env)
2. Get the code
::
bzr branch lp:rnr-server
This assumes you already installed, configured and setup Bazaar
3. Set up the environment
::
cd rnr-server
make bootstrap
This will install all necessary dependencies and create a local
settings file at `<rnr-root>/../local_config/settings.py` you can use
to override provided defaults.
4. Set up the database
::
By default RnR is set up to use sqlite on a dev environment. This
will change in the near future, but until then there are no extra
steps to be taken.
.. note::
You could also set this to use a system database, by changing the
settings in your local "settings.py" file. See `Testing and
developing with Postgres` below.
5. Run the tests
::
fab test
6. Run the instance
::
fab run
This by default will use a local sqlite database and ask you if you want to
create an admin account. If you want to also load up a few dummy apps and
reviews to test the site, use::
fab manage:'loaddata samples'
To see any media (images and CSS) you'll need to define both the
`SERVE_STATIC_MEDIA` and `MEDIA_ROOT` settings in your local
configuration.
Testing and developing with Postgres
====================================
PostgreSQL is installed automatically by installing the system
dependencies. After you have gone through that step, edit the
`/etc/postgresql/9.1/main/pg_hba.conf` file to allow trusted access to
the `postgres` user (note: obvious security risk for any net-facing
machine - if you're using a publicly accessible machine, then you
should know a more secure way of enabling access :P). Find the line
that looks like::
# Database administrative login by Unix domain socket
local all postgres peer
and change peer to trust, save, then restart PostgreSQL with::
sudo service postgresql restart
Ensure that the RnR database first exists::
$ psql -U postgres
postgres=# create database rnr;
CREATE DATABASE
postgres=# \q
Then modify your `<rnr-root>/../local_config/settings.py`::
from django_project.settings_devel import *
DATABASES['default']['ENGINE'] = 'django.db.backends.postgresql_psycopg2'
DATABASES['default']['NAME'] = 'rnr'
DATABASES['default']['USER'] = 'postgres'
And finally, verify your setup with::
fab test
Updating dependencies
=====================
Sourcedeps::
make sourcedeps
Pip requirements::
make install-virtualenv-requirements
Packaged dependencies::
sudo apt-get update && sudo apt-get install rnr-server-{developer-,}dependencies
Background Reading
==================
For those new to this project, this may help bring you up to speed
quickly. The Ratings and Reviews server uses some conventions that
you may not have seen before. These include:
- Local settings located at `<rnr-root>/../local_config/settings.py`.
- Running commands via fab: fab manage:COMMAND (alternatively using
`python django_project/manage.py COMMAND`).
- Running tests via fab: `fab test`.
Useful links:
- Deb package reviews API client: http://bazaar.launchpad.net/~rnr-developers/rnr-server/rnrclient
- Click package reviews API docs: https://wiki.ubuntu.com/AppStore/Interfaces/RatingsAndReviews
|