Civil Debate Wall Website
The Civil Debate Wall website allows the public to view and participate in debates that are happening through the website and physical installation at the Bob Graham Center at the University of Gainesville Florida. This project is concerned with three main components of the overall project:
- The data API (used by the website and kiosk)
- The public facing website
- The CMS/Admin Area
The application is built primarily using the following frameworks, technologies, and APIs:
The Civil Debate Wall codebase is licensed under the Affero GNU Public License version 3. Please see the files in the /LEGAL folder for details.
To work on this project you'll want to have the following software installed on your local machine:
Another great resource for setting up a proper Python environment can be found over at python-guide.org. Once you've got the software installed, make sure that MongoDB is running as well.
Now to get the project and its dependencies (if you haven't already). Perform the following from the command line:
$ git clone firstname.lastname@example.org:lp-cdw.4.git civildebatewall $ cd civildebatewall $ mkvirtualenv cdw -p /usr/local/bin/python2.7 $ pip install -r requirements.txt
Once you've done this you'll want to setup your development rcfile. Copy the sample rcfile by performing the following:
$ cp rcfile.sample rcfile.development
Next you'll want to change the following values in rcfile.development to be compatible with your machine (hopefully these are all the relevant ones):
app_debug = True app_mongodb_db = arbitrary_db_name app_mongodb_username = your mongo user app_mongodb_password = your mongo password app_mongodb_host = localhost? app_mongodb_port = your mongo port app_image_storage_type = local app_temp_dir = /path/to/somewhere/temporary app_user_images_dir = /path/to/project/static/images/users
Then generate a config file by running
$ fab -c rcfile.development generate_local_config
With any luck you'll be good to go and running:
$ python main.py
will startup the local development server.
A test mongodb instance is necessary to get nosetests to run:
mongod --dbpath=./mongo.data/ --port=10051
If you need to work on the Facebook login/registration component, you'll need to create a dummy application under a Facebook account you have access to. Add the app ID and app secret values to your rcfile or configuration file. It's also quite useful to setup a host rule on your system for the domain associated with your dummy app. For instance, my dummy app's domain is dev.www.civildebatewall.com and I have a hosts file entry that looks like so:
$ 127.0.0.1 dev.www.civildebatewall.com
This way there shouldn't be any errors when trying to authenticate against Facebook. If you end up doing this you'll need to ensure you configure the
app_local_request value in
rcfile.development and regenerate it or manually edit the
LOCAL_REQUEST config value in
Additionally, if you need Twilio account information you'll need to setup your own or ask for the account information from someone at Local Projects or University of Florida.
This project takes advantage of the Python webassets library. However, compiling and processing CSS and JS files must still be done manually before deploying to an environment that does not run in debug mode. Whenever it comes time to deploy or commit changes to JS and/or CSS files, be sure to run them through the assets manager:
$ python manage.py assets clean & python manage.py assets build
Assets compilation requires
lessc, which is installed thusly:
npm install -g less
Make sure that the
lessc command works:
npm installs binaries to /usr/local/share/npm/bin, so make sure that's in your path:
cat "/usr/local/share/npm/bin" >> /etc/paths.d/99-npm
Once you have done this, be sure to add and commit the generated files before deploying.
CAVEAT: Do NOT use the /usr/bin/less lesserizer. It seems to create corrupt css files on occasion.
Deployment is done using Fabric. Currently the application is hosted on Amazon EC2 instances configured with nginx, uWSGI, and other various utilities and apps. Deployment is easily done by having an ssh key, a properly configured rcfile for the environment and simply running the following command:
$ fab -c rcfile.environment deploy
To obtain the ssh key and/or refills contact: email@example.com.
Please note, that when deploying, only deploy the
develop branch to the staging environment and the
master branch to production.