A platform for collective archives.
To get up and running using docker, see readme-docker.md.
Install the following on your system:
- memcached
- elasticsearch (using the official repositories is recommended)
- mongodb
- curl
- git
- python
- pip
- VirtualEnv and VirtualEnvWrapper
- development libraries for python, libjpeg8, libxml2, libxslt1, zlib1g (needed for python libraries to build successfully)
If you are running Ubuntu 14.04, you can install all the above with these commands. This probably also works on other recent versions of Ubuntu.
sudo apt-get install openjdk-7-jdk mongodb elasticsearch memcached curl git python-pip python-virtualenv virtualenvwrapper python-dev libxml2 libxml2-dev libxslt1-dev zlib1g-dev libjpeg8-dev
# start elasticsearch on startup
sudo update-rc.d elasticsearch defaults
-
Clone this repository:
git clone git@github.com:aaaaarg/webapp-2013.git
-
Change into the cloned directory
cd webapp-2013
-
Create a new virtualenvironment and switch to it
mkvirtualenv grrrr workon grrrr
-
Install the required python dependencies
pip install -r requirements.txt
-
As a temporary workaround, run this command to get a version of Flask-Social that works with the current mongoengine (TODO: this didn't work for me; is it still needed?)
pip install --upgrade https://github.com/mattupstate/flask-social/tball/develop
-
Copy
flask_application/config.py.example
toflask_application/config.py
and edit the settings as appropriate.cd flask_application cp config.py.example config.py vi config.py
-
Create an elasticsearch index named 'aaaarg'.
curl -XPUT 'localhost:9200/aaaarg?pretty'
-
Populate the database with some data
python manage.py populate_db
-
Run the development server. You should be able to access the application at http://localhost:5000/
# set environment export DEV=yes # run server python manage.py runserver
If you're running the app from inside a virtual machine and want to be able to access it from outside the VM, run this command instead, and load use the IP address in the browser, i.e. something like http://192.168.1.10:5000/
python manage.py runserver -t 0.0.0.0
####Non-Python Projects:
- Twitter Bootstrap
####Contributing Projects:
- https://github.com/swaroopch/flask-boilerplate The project's structure is built from this
- Flask-Security Example App
- https://github.com/earle/django-bootstrap uses some template macros
##Commands
Run these commands by using python manage.py <command>
reset_db
- Drops all Mongo documentspopulate_db
- Script to fill the database with new data (either for testing or for initial). You can edit thepopulate_data
command inflask_application/populate.py
(Right now it is set up to add Users.)runserver
- Runs a debug server- Commands included with Flask-Security can be found here: http://packages.python.org/Flask-Security/#flask-script-commands and by looking in
flask_application/script.py
##Templates
The base template is based off of Django-bootstrap and is found under: flask_application/templates/bootstrap/layouts/base_navbar_responsive.html
##Static Content This project is designed to use CSSMin and Flask-Assets to manage Assets to save on bandwidth and requests.
You can find this in the css_bootstrap
block of the layout template. You can also simply edit static/css/site.css
as that is included in the base setup.
##Encoding and Decoding Id's Sometimes you won't want simple URLs revealing the order of the object ids. For example:
http://example.com/users/view/1/
So you can use encode_id
and decode_id
found in flask_application/helpers.py
So
http://example.com/users/view/1/
becomes
http://example.com/users/view/w3c8/
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.