You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Froide is a Freedom Of Information Portal written in Python using Django 1.4.3.
8
-
The name comes from Freedom of Information (de). Also Froide
9
-
sounds like Freude which is German for joy.
7
+
Froide is a Freedom Of Information Portal written in Python using Django 1.5.
10
8
11
-
It is used by the German FoI site fragdenstaat.de, but it is fully
9
+
It is used by the German and the Austrian FOI site, but it is fully
12
10
internationalized and written in English.
13
11
14
12
Docs
15
13
----
16
14
17
15
[Read the documentation](http://readthedocs.org/docs/froide/en/latest/) including a [Getting Started Guide](http://readthedocs.org/docs/froide/en/latest/gettingstarted/).
18
16
17
+
Froide is supported by the [Open Knowledge Foundation](http://okfn.org/).
Copy file name to clipboardExpand all lines: docs/about.rst
+15-10
Original file line number
Diff line number
Diff line change
@@ -2,9 +2,8 @@
2
2
About
3
3
=====
4
4
5
-
Froide was designed to mimic the functionality of `What do they know <http://whatdotheyknow.com>`_ – a Freedom of Information portal in the UK written in Ruby on Rails 2.3. At the time when a German FoI portal was needed, the general FoI solution forked from WDTK called `Alaveteli <http://alaveteli.org>`_ was hard to install and not ready for reuse.
6
-
That's why Froide was developed as a fresh start, fully
7
-
internationalized and configurable written in Django 1.3 to power `Frag den Staat <https://fragdenstaat.de>`_.
5
+
Froide is a Freedom of Information portal software written in Python with Django 1.5.
6
+
8
7
9
8
Development Goals
10
9
-----------------
@@ -36,20 +35,26 @@ Features
36
35
request-unique email address (using SMTP) and the platform will receive answers on
37
36
that mail address (by accessing an IMAP account).
38
37
- Search functionality for Requests and Public Bodies.
39
-
- Error Reporting interface via Sentry.
38
+
- A read/write REST-API
39
+
- Redaction of PDFs
40
40
41
41
Dependencies
42
42
------------
43
43
44
44
A detailed list of Python package dependencies can be found in `requirements.txt`, but here is a general overview:
45
45
46
-
- Django 1.3 - the Web framework
47
-
- South 0.7.3 - the database migration framework (development dependency)
48
-
- Sphinx 1.0.7 - the documentation tool (development dependency)
49
-
- Celery 2.2.5 - task queue for background processing
50
-
- Haystack 1.2.0 - abstraction layer for search
46
+
- Django 1.5 - the Web framework
47
+
- Celery 3.X - task queue for background processing
48
+
- Haystack 2.X-beta - abstraction layer for search
49
+
50
+
A development goal is that, even though a task queue (like Celery) and a search server (like Solr) are highly recommended, they are not necessary for either development or production setup and can be replaced with Cronjobs and database queries respectively (results/performance will probably degrade, but it will work nonetheless).
51
51
52
-
A development goal is that, even though a task queue (like Celery) and a search server (like Solr) are highly recommended, they are not necessary for either development or production setup and can be replaced with Cronjobs and database queries respectively (results/performance will probably degrade, but it should work).
52
+
History
53
+
-------
54
+
55
+
Froide was designed to mimic the functionality of `What do they know <http://whatdotheyknow.com>`_ – a Freedom of Information portal in the UK written in Ruby on Rails 2.3. At the time when a German FoI portal was needed, the general FoI solution forked from WDTK called `Alaveteli <http://alaveteli.org>`_ was hard to install and not ready for reuse.
56
+
That's why Froide was developed in spring 2011 as a fresh start, fully
57
+
internationalized and configurable written in Django 1.3 to power `Frag den Staat <https://fragdenstaat.de>`_ which launched in August 2011.
The Django admin exposes database objects to staff users and superusers.
6
+
Superusers have access to all objects while staff users can be given specific read/write/delete access to kinds of objects (e.g. only public bodies). Users can also given a group that has certain rights associated with it.
Copy file name to clipboardExpand all lines: docs/configuration.rst
+12-43
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ Configuration
4
4
5
5
Froide can be configured in many ways to reflect the needs of your local FoI portal.
6
6
7
-
All configuration is kept in the Django `settings.py` file. Individual settings can be overwritten by placing a `local_settings.py` file on the Python path (e.g. in the same directory) and redefining the configuration key in there.
7
+
The `custom_settings.py.example` file that comes with froide has all the settings from the `settings.py` file but they are commented out. You can copy this file to `custom_settings.py`
8
8
9
9
Froide Configuration
10
10
--------------------
@@ -37,6 +37,9 @@ The following keys in that dictionary must be present:
37
37
*integer* The id of the Freedom of Information law in the database
38
38
that is used by default (e.g. 1)
39
39
40
+
**search_engine_query**
41
+
*string* You can give a URL with string formatting placeholders `query` and `domain` in them that will be presented to the user as the URL for web searches. The default is a Google search.
42
+
40
43
41
44
Greeting Regexes
42
45
----------------
@@ -77,7 +80,7 @@ You must adapt the standard Django parameters for sending email.
77
80
Configure the backend depending on your environment (development vs.
You can give a URL with string formatting placeholders `query` and `domain` in them that will be presented to the user as the URL for web searches via the setting `SEARCH_ENGINE_QUERY`. The default is a Google search.
152
+
More suggestions of settings you can change can be found in the `custom_settings.py.example` file that comes with froide.
185
153
186
154
187
155
Securing your site
@@ -193,11 +161,10 @@ parts configurable by `local_settings` you can use the following
193
161
setting::
194
162
195
163
SECRET_URLS = {
196
-
"admin": "my-secret-admin",
197
-
"sentry": "my-secret-sentry"
164
+
"admin": "my-secret-admin"
198
165
}
199
166
200
-
It's also recommended to protect the admin and sentry further via HTTP
167
+
It's also recommended to protect the admin further via HTTP
201
168
auth in your production reverse proxy (e.g. nginx).
202
169
203
170
The app `djangosecure <https://github.com/carljm/django-secure/>`_ is part of Froide
@@ -212,3 +179,5 @@ Some Django settings related to security and SSL::
212
179
SESSION_COOKIE_AGE = 3628800 # six weeks for usability
213
180
SESSION_COOKIE_HTTPONLY = True
214
181
SESSION_COOKIE_SECURE = True
182
+
183
+
Make sure that your frontend server transports the information that HTTPS is used to the web server.
Copy file name to clipboardExpand all lines: docs/gettingstarted.rst
+91-33
Original file line number
Diff line number
Diff line change
@@ -9,71 +9,129 @@ more advanced features are discussed at the end.
9
9
Set up the development environment
10
10
----------------------------------
11
11
12
-
You should be using `virtualenv` and it is suggested you
13
-
also use `virtualenvwrapper`. Setup a virtual environment for development like so::
12
+
You should be using a Python virtual environment.
13
+
Setup a virtual environment for development with `virtualenv`like so::
14
14
15
-
mkvirtualenv --no-site-packages froide
15
+
virtualenv --no-site-packages ~/pyenv
16
+
. ~/pyenv/bin/activate
16
17
17
-
Get the source code with Git from the official GitHub repository or from
18
-
your fork::
18
+
Get the source code with Git from the GitHub repository::
19
19
20
20
git clone git://github.com/stefanw/froide.git
21
21
cd froide
22
22
23
23
Install the requirements inside the virtual env with `pip`::
24
24
25
-
which pip
26
-
<should display your virtual env pip>
27
25
pip install -r requirements.txt
28
26
29
-
If only your global `pip` is available, run `easy_install pip`. The dependency installation takes a couple of seconds, but after that everything is in place.
27
+
The dependency installation may take a couple of minutes, but after that everything is in place.
30
28
31
-
Copy `custom_settings.py.example` to `custom_settings.py`::
29
+
Sync and migrate and *do NOT* create a superuser just yet::
30
+
31
+
python manage.py syncdb --noinput --migrate
32
+
33
+
Now you can already start the web server::
34
+
35
+
python manage.py runserver
36
+
37
+
Visit `http://localhost:8000 <http://localhost:8000>`_ and there is your running Froide instance!
38
+
39
+
You can quit the server (Ctrl+C) and create a superuser account::
40
+
41
+
python manage.py createsuperuser
42
+
43
+
44
+
Add basic database objects
45
+
--------------------------
46
+
47
+
Run the web server again and login to the admin interface at `http://localhost:8000/admin/ <http://localhost:8000/admin/>`_ with the credentials of your superuser.
48
+
49
+
The first thing you should do is create a jurisdiction. Click on "Jurisdiction" in the "Publicbody" section and then on "Add Jurisdiction".
50
+
Name your jurisdiction however you want (e.g. Federal). If you only ever intend to have one, the name will not even show up. Click "Save" to continue.
51
+
52
+
Go back into the public body section and add an FOI law. Give it a name (e.g. Freedom of Information Act) and choose a jurisdiction. There are many more things that can be configured, but you can leave them for now.
53
+
54
+
Now you can add your first public body by going back to the public body section and clicking on "Add" next to "Public Bodies". Give it a name (e.g. Ministry of the Interior).
55
+
Click on the little plus-sign next to topic to add a topic for this public body. The classification is to distinguish different areas of government (e.g. "Ministry", "Council").
56
+
If you want to make a request to this public body, it needs to have an email address.
57
+
Select your previously created jurisdiction and FOI law and save.
58
+
59
+
You should also fill out your user details like your name in the user section of the admin.
60
+
61
+
Now you are ready to make your first request. Go back to the front page and give it a go. You can also find out more about the :doc:`admin`.
62
+
63
+
64
+
Custom configuration
65
+
--------------------
66
+
67
+
By default the Django Web server uses the `settings.py` file in the froide directory (the `froide.settings` Python module). This will be fine for your first experiments but if you want to customize your froide instance you will want your own settings file.
68
+
69
+
Go into the froide directory and copy the `custom_settings.py.example` to `custom_settings.py`::
32
70
33
71
cd froide
34
72
cp custom_settings.py.example custom_settings.py
35
73
36
-
The development environment uses SQLite. You can override the default Django settings values for froide in your `custom_settings.py`, if you want, but you don't have to.
74
+
Now you can customize that settings file to your liking. Note that it imports the original `settings.py` at the top, so you only have to change the values you need to change.
37
75
38
-
Your `custom_settings.py` file (you can name it differently) is your Django settings file that you must give on each Django manage.py command. You can also set the `DJANGO_SETTINGS_MODULE` environment variable.
76
+
In order for Django to start your web server with these new settings you either have to set the environment variable `DJANGO_SETTINGS_MODULE` or give the settings module as a command line argument.
39
77
40
-
Sync and migrate and *do NOT* create a superuser just yet::
Since it can be annoying to type this (or to remember to export the environment variable), you can create a shortcut shell script, create an alias, put an export in your virtualenv's `activate` file or use `virtualenvwrapper <http://virtualenvwrapper.readthedocs.org/en/latest/>`_ and put the export in your `postactivate` hook.
47
89
48
-
That's it for a setup that basically works. Run this::
and go to `http://localhost:8000 <http://localhost:8000>`_. You should
53
-
be greeted by a working Froide installation. It doesn't have any data
54
-
inside, but you can change that by going to `http://localhost:8000/admin/ <http://localhost:8000/admin/>`_ and logging in with your superuser account.
92
+
Search with Haystack
93
+
--------------------
94
+
95
+
In order to get a real search engine running you need to override the `HAYSTACK_CONNECTIONS` setting with the details of your search engine. Find out `how to configure your search engine at the Haystack Docs <http://django-haystack.readthedocs.org/en/latest/tutorial.html#modify-your-settings-py>`_.
96
+
97
+
An example configuration for solr would look like this::
For more information on the different models you find in the admin visit :doc:`models`.
110
+
From the standard settings file everything is already setup for background tasks except that they are not running in the background.
57
111
58
-
Run tests
59
-
---------
112
+
You need to change the `CELERY_ALWAYS_EAGER` setting to `False` in your custom settings::
60
113
61
-
Froide has a test suite. Copy `test_settings.py.example` to `test_settings.py`. `test_settings.py` does not use your `custom_settings.py` changes.
114
+
CELERY_ALWAYS_EAGER = False
62
115
63
-
You can then run for tests::
116
+
You need a broker for Celery. Find out more at the `Celery Docs <http://docs.celeryproject.org/en/latest/getting-started/first-steps-with-celery.html#choosing-a-broker>`_.
64
117
65
-
make test
118
+
We recommend `RabbitMQ <http://www.rabbitmq.com/>`_ as broker. Install it and then start it in a different terminal like this::
66
119
67
-
This also does test coverage analysis that you can then
68
-
find at `htmlcov/index.html`.
69
-
Note some tests will not work without a search engine like solr running.
120
+
rabbitmq-server
70
121
122
+
After you started the broker open yet another terminal, activate your virtual environment and run the celery worker like this::
71
123
72
-
Search with Haystack and Solr
73
-
-----------------------------
124
+
python manage.py celeryd -l INFO -B
74
125
126
+
Now your server will send background tasks to Celery. Lots of common tasks are designed as background tasks so that an ongoing HTTP request can send a response more quickly. The following things are designed as background tasks:
75
127
76
-
Background Processing with Celery
77
-
---------------------------------
128
+
- Search Indexing: Updates to database objects are indexed in the background
129
+
- Email Sending: When an action triggers an email, it's sent in the background
130
+
- Denormalized Counts on database objects
78
131
132
+
Celery also takes the role of `cron` and handles periodic tasks. You should set up periodic tasks in the admin under "Djcelery - Periodic tasks". Here is a recommended configuration:
0 commit comments