2. Installation

This document assumes you are familiar with Python and Django.

2.1. Requirements

2.2. Optional

2.3. Python Virtual Environment

The easiest way to install OpenEats2, is to create a python virtual environment. This allows for keeping all the packages for OpenEats2 in a separate place. Saving the hassle of dealing with application dependencies.

2.3.1. Installing virtualenv

To install virtualenv from the command line type:

pip install virtualenv

You will also want to install the virtualenvwrapper package to make management of the virtual environment simpler

To install virtualenvwrapper from the command line type:

pip install virtualenvwrapper

2.3.2. Creating the virtualenv

To create the skeleton virtualenv run the following commands:

export WORKON_HOME=~/Envs
mkdir -p $WORKON_HOME
source /usr/local/bin/virtualenvwrapper.sh
mkvirtualenv openeats --no-site-packages
workon openeats

Note

You can set your workon home directory anywhere you want it doesn’t have to be in the Envs directory The virtualenvwrapper.sh may not be located in /usr/local/bin it varies by operating system. For help with virtualenvwrapper vist their site.

2.4. Installing

  • Download the latest package from github
  • Unzip the files into a directory that your web server can access
  • Make sure the directory is called openeats or python won’t be able to find it
  • Install the required packages

2.4.1. Installing Requirements packages

To install all the packages that OpenEats2 requires perform the following steps.

  • Activate your virtualenv

  • Change to the directory that you unzipped the OpenEats2 files into

  • Run the following command:

    pip install -r OE2_Requirements.txt
    

2.4.2. Database

OpenEats2 has been tested with MySQL and SQLite and minimal testing has been done with PostgreSQL_ Technically it should be able to work under any django supported database. SQLite is built into python and does not require any additional software.

2.4.2.1. MySQL

To install the MySQL-Python module perform the following steps

  • Activate your OpenEats2 virtualenv

  • Run the following command:

    pip install mysql-python
    

2.4.2.2. PostgresSQL

To install the Postgres module perform the following steps

  • Activate your OpenEats2 virtualenv

  • Run the following command:

    pip install psycopg2
    

There is a small issue with PostgresSQL that will cause you an error when loading the data. To get around this issue perform the following steps;

  • Copy the postgres_settings.py to settings.py.
  • Then skip running the migrate command from the Required Data section below.
  • After running the ./manage.py syncdb command from the Required Data section, edit the settings.py file and remove the # from in front of the word south in the file and save it.
  • Then run the command ./manage.py migrate –fake.
  • Continue with the rest of the instructions as normal.

2.4.3. Load Initial Data

OpenEats2 comes with default data that needs to be loaded into the database.

2.4.3.1. Required Data

Running the following command from the OpenEats2 directory, should load the required data:

./manage.py syncdb --all
./manage.py migrate --fake
./manage.py loaddata fixtures/navbar_about_data.json

Note

Before you run this make sure you have setup your database in the settings.py file. For more information on this see Database

2.4.3.2. Optional Data

You can pre-load courses and cuisines by running the following commands from the OpenEats2 directory:

./manage.py loaddata recipe_groups/fixtures/course_data.json
./manage.py loaddata recipe_groups/fixtures/cuisine_data.json

2.4.3.3. Collecting Static Files

To collect the static files from the third party applications run the following command:

./manage.py collectstatic

2.4.3.4. Running

After the install you can run the following command to start the internal Django webserver. This will allow you to test your site prior to setting up a “real” webserver such as Apache:

./manage.py runserver 8000

This will bind the webserver to port 8000 on 127.0.0.1 otherwise known as localhost. If you are deploying OpenEats2 to a remote server and not your local computer run the following command instead:

./manage.py runserver 0.0.0.0:8000

You should then be able to access your new OpenEats2 site by pointing your browser to your URL with port 8000:

http://yoursite:8000

Note

You should not run OpenEats2 in production with the built in webserver. You will want to setup Apache or Ngnix Check out the Django Apache WSGI document for more info.

2.4.3.5. Site Name

You will need to set up your site name before you can use certain features. See Change Site Name