GithubHelp home page GithubHelp logo

meh-als-gmues's Introduction

ortoloco.ch

Build Status

die regionale gartenkooperative

We implement a "specific" web solution to organize all the work on a farm as a group of about ~400 persons.

Setting up locally

Following instructions work for MacOS.

Set your environment variables

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]

Installing requirements

Clone repository on you machine and enter the directory

cd ortoloco

Now start installing

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)

Create DB from scratch

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.

Backup and restore local dev database

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.

Create new migration

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.

Test server

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.

Create admin user

Use following command to create a super user, if not yet available:

manage.py createsuperuser

Create loco for admin user

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:

Change password for super user ('admin' is the username)

./manage.py changepassword admin

How to migrate from mysql to postgres-sql

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

How to move the live-data to dev

Between Heroku apps

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

meh-als-gmues's People

Contributors

amerkle avatar mklarmann avatar olmaga avatar rbf avatar rezahousseini avatar stierli avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.