diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..b5903b7d4 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,110 @@ +# Set-up instructions +Use these instructions to set up a local development environment. + +## Prerequisites +The following packages are helpful/required to start developing CiviWiki: + +- PostgreSQL +- Redis + - [Redis installation instructions](https://redis.io/topics/quickstart) + +## Set-up +The following instructions assume you have already cloned this repository. + +### Requirements +You will need a virtual environment with Python 2.7 installed. + +Once your virtual environment is active, run the following command to install the requirements: + +```py +pip install -r requirements.txt +``` + +The above command should be run in the same directory as the requirements.txt file. + +### Environment variables +There are several environment variables that are needed for things to work properly: + +- SUNLIGHT_API_KEY +- GOOGLE_MAP_API_KEY +- REDIS_URL (optional) +- AWS_STORAGE_BUCKET_NAME (optional) +- AWS_S3_ACCESS_KEY_ID (optional) +- AWS_S3_SECRET_ACCESS_KEY (optional) +- DATABASE_URL (optional) +- CIVIWIKI_LOCAL_NAME - database name in local PostgreSQL instance +- CIVIWIKI_LOCAL_USERNAME - username in local PostgreSQL instance with rights to database +- CIVIWIKI_LOCAL_PASSWORD - password for database user + +You can save some time and declare those environmental variables all at once with a shell script. E.g. + +```sh +#! /bin/bash + +# CiviWiki (Django) +export DJANGO_SECRET_KEY=********** + +# Third party +export SUNLIGHT_API_KEY=********** +export GOOGLE_MAP_API_KEY=********** + +# PostgreSQL +export CIVIWIKI_LOCAL_NAME=civiwiki +export CIVIWIKI_LOCAL_USERNAME=civiwiki +export CIVIWIKI_LOCAL_PASSWORD=password +``` + +To activate all of the environment variables, e.g. on Ubuntu Linux, use the following command: + +``` +. setup_environment_variables.sh +``` + +Note the pattern is 'dot space filename.sh' + +### Initial CiviWiki (Django project) set up +Once you have a working virtual environment, installed all requirements, and have set up environment variables, you are ready to populate the initial database: + +```py +python manage.py migrate +``` + +If everything goes well, you should see a bunch of green 'OK's. Django will create the database structure for you. + +### Populate initial data +There are two files, located in the `/data` directory, that contain initial categories and congressional data. Run the following commands to initialize the congressional and categoies data: + +```py +python manage.py loaddata /data/congress.json +``` + +```py +python manage.py loaddata /data/categories.json +``` + +### Collect static files +Certain resources, such as CSS and JavaScript files, need to be served from a static directory. Run the following command to collect static files for Django to serve: + +```py +python manage.py collectstatic +``` + +### Create super user +You will need a super user in order to log in and manage CiviWiki: + +```py +python manage.py createsuperuser +``` + +## Run CiviWiki +If the above steps are complete, we can start CiviWiki: + +```py +python manage.py runserver +``` + +## Register initial user +Once CiviWiki is running, visit the front page (probably something like http://localhost:8000). Once there, click 'log in/register', and then 'register new user'. + +### Enable beta access for new user +Once you have submitted the new user registration fom, you will be directed to the 'Development in progress' screen. In order to access the site functionality, you need to modify the new user record and set the `beta_access` field to `True` for the user record in the `api_account` table. diff --git a/License.md b/License.md index 4848f37c2..286d29a9a 100644 --- a/License.md +++ b/License.md @@ -2,7 +2,7 @@ GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 -Copyright © 2007 Free Software Foundation, Inc. http://fsf.org/ Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. +Copyright © 2017 CiviWiki. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble @@ -166,4 +166,4 @@ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY C Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. -END OF TERMS AND CONDITIONS +END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/civiwiki/celery.py b/civiwiki/celery.py index 70b10dbc4..a7f3ac679 100644 --- a/civiwiki/celery.py +++ b/civiwiki/celery.py @@ -26,4 +26,7 @@ def debug_task(self): """ Debug printer for celery requests """ - print 'Request: {0!r}'.format(self.request) + + celery_debug_message = 'Request: {0!r}'.format(self.request) + + print(celery_debug_message) diff --git a/civiwiki/urls.py b/civiwiki/urls.py index f8bd12272..a7e16765b 100644 --- a/civiwiki/urls.py +++ b/civiwiki/urls.py @@ -20,7 +20,6 @@ from api import urls as api from authentication import urls as auth from frontend_views import urls as frontend_views -# import notifications urlpatterns = [ url(r'^admin/', include(admin.site.urls)), diff --git a/frontend_views/urls.py b/frontend_views/urls.py index 4467cfa9b..79fa70365 100644 --- a/frontend_views/urls.py +++ b/frontend_views/urls.py @@ -17,5 +17,4 @@ url(r'^invite$', v.invite, name='invite'), url(r'^beta_register/(?P[\w.%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4})/(?P\w{31})$', v.beta_register, name='beta_register'), url(r'^$', v.base_view, name='base'), - url(r'', v.does_not_exist, name='404') ] diff --git a/frontend_views/views.py b/frontend_views/views.py index 76807e13b..31d15fb2b 100644 --- a/frontend_views/views.py +++ b/frontend_views/views.py @@ -275,6 +275,3 @@ def about_view(request): def support_us_view(request): return TemplateResponse(request, 'static_templates/support_us.html', {}) - -def does_not_exist(request): - return TemplateResponse(request, 'base/404.html', {}) diff --git a/webapp/templates/base/404.html b/webapp/templates/base/404.html deleted file mode 100644 index 483bd047e..000000000 --- a/webapp/templates/base/404.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - {% load staticfiles %} - - CiviWiki - - - - Page Does not exist! - -