die regionale gartenkooperative
We implement a "specific" web solution to organize all the work on a farm as a group of about ~400 persons.
Following instructions work for MacOS.
This should do it for your local setup:
export ORTOLOCO_DATABASE_ENGINE=django.db.backends.sqlite3
export ORTOLOCO_DATABASE_NAME=db.sqlite
export ORTOLOCO_EMAIL_HOST=smtp.gmail.com
export ORTOLOCO_EMAIL_PASSWORD=YOUR_GMAIL_APP_PASSWORD
export [email protected]
cd ortoloco
sudo easy_install pip
sudo pip install virtualenv
virtualenv --distribute venv
source ./venv/bin/activate
pip install --upgrade -r requirements.txt
NOTE: All requirements are not easily installable on Mac OS X. If you encounter some issues (i.e. EnvironmentError: mysql_config not found
or pg_config executable not found
) you might run instead:
pip install --upgrade -r requirements-mac.txt
wich removes following packages from the requirements:
MySQL-python==1.2.5
django-toolbelt==0.0.1
psycopg2==2.5.1
NOTE: You might be able to install "brew install mysql" and "brew install postgresql" and "brew install pg" instead (before)
In ortoloco/settings.py, comment out all non-django apps (loco_app ,my_ortoloco,static_ortoloco, south, photologue). Then run following command:
./manage.py syncdb
Reactivate the outcommented apps above and run following commands:
./manage.py syncdb
./manage.py migrate
You might be guided through these steps with make createdb
.
With make savedb
you can easily make a snapshot of the current local
database file (if using SQLite
), and restore it (i.e. the last db
snapshot file) with make restoredb
.
You might want to look at the Makefile
for more details.
When the database structure changes, you must perform a new migration:
./manage.py schemamigration loco_app --auto
./manage.py migrate loco_app
You might be guided through these steps with make migratedb
.
Run following command to launch a server on http://localhost:8000:
./manage.py runserver
You might run this with make
, which will additionally open the URL
on your browser.
Use following command to create a super user, if not yet available:
manage.py createsuperuser
The first time you try to login with the initial admin user you will
encouter an error like User has no Loco
. To create a Loco
for this
user, you have to activate a secret 😄 URL in url.py
and call it from the browser:
Afterwards, you might have to logout with following URL:
./manage.py changepassword admin
First read this: https://github.com/lanyrd/mysql-postgresql-converter
Then import the data into the heroku-db (find the values here: https://postgres.heroku.com/databases/ortoloco-database) psql -U -d -h -f path/to/postgres.sql
SOURCE_APP=ortoloco
TARGET_APP=ortoloco-dev
heroku pg:backups restore $(heroku pg:backups public-url --app $SOURCE_APP) DATABASE_URL --app $TARGET_APP
See: Importing and Exporting Heroku Postgres Databases with PG Backups