Skip to content

Commit

Permalink
Merge pull request RyanNoelk#40 from RyanNoelk/dev
Browse files Browse the repository at this point in the history
Release 1.0.0
  • Loading branch information
RyanNoelk authored Dec 5, 2016
2 parents 8b521f5 + e67cac7 commit e9a610c
Show file tree
Hide file tree
Showing 668 changed files with 4,505 additions and 65,165 deletions.
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
*.pyc
db/*
local_settings.py
frontend/static-files/*
static-files/*
*.log
changelog.txt
search_index/
.idea/
frontend/site-media/
site-media/
openeats.db
*.css.map
*.js.map
templates/angular/
frontend/node_modules/
frontend/.DS_Store
static-files/
database/
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM python:2.7
ENV PYTHONUNBUFFERED 1
RUN mkdir /code
WORKDIR /code
ADD base/requirements.txt /code/requirements.txt
RUN pip install -r requirements.txt
ADD . /code/
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2015-present Ryan Noelk

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
30 changes: 0 additions & 30 deletions OE2_Requirements.txt

This file was deleted.

118 changes: 97 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,97 @@
#OpenEats Project

OpenEats is a recipe management site that allows users to create, share, and store recipes. OpenEats was created using django, a python web framework
and several django plugins. Some of the features of OpenEats are;

* Create, share and edit your own recipes
* Mark your own recipes as private so only you can see them
* Follow other chefs on OpenEats and see what they are rating, and adding
* Create custom grocery list
* Add recipes to your grocery lists
* Share grocery list with other people. This is handy for a family to have a list everyone can update
* Rate recipes
* Comment on recipes
* 100% OpenSource and free
* A complete administration backend to maintain your site
* Export recipes to PDF or MealMaster format
* Internationalization Support

You can try OpenEats2 now at the [demo site](http://new.openeats.org)

Documentation can be found at [read the docs](http://openeats2.readthedocs.org/)
# OpenEats Project

OpenEats is a recipe management site that allows users to create, share, and store recipes. This fork uses Django Rest Framework as a backend and React (with flux) as a front end.

The main goals of this project are two fold. One, I wanted a place to store my personal collection of recipes and share them with close friends and family. Two, I wanted to learn react :). I went digging around for a starting point and gathering ideas when i came across open eats. It had some cool ideas and was well documented for the most part.

I have a lot of ideas as far as features go. But since I moved the whole UI to react and the backend to a pure API, I'm currently working on getting the core of the project stable. The Core, in my mind, consists of a few things.

- Creating, viewing, and editing recipes.
- Browsing and searching for recipes.
- A simple homepage and about page.

# Running the App

## Docker

```bash
docker-compose build
docker-compose up -d
```

You can then use `docker-compose run --rm api bash` to run the DB migrations shown below (eg: `python ./manage.py migrate`).


## Manually

* `git clone https://github.com/RyanNoelk/OpenEats.git`
* `cd openeats`
* `git checkout dev`
* Create a python virtual environment (I use [virtualenvwrapper](https://virtualenvwrapper.readthedocs.io/en/latest/)).
* `pip install -r base/requirements.txt`

Next we need to create a `base/local_settings.py` file for configuring your particulate instance. Things like your secret key and database settings should go here.

Now that we have the dependencies. We need to setup the DB. The default is sqlite, which is fine for dev purposes. But if you want something a bit more robust or if you want to run this in a production environment you should use something like postgres or mysql. The current configuration should work with any database you choose to use. See the [django database docs](https://docs.djangoproject.com/en/1.10/ref/settings/#std:setting-DATABASES) for setting up your database. As a side note, please make sure that you install any additional drivers that python needs to work with the database that you choose.

The migrations should all be present in the repo. Once the database is installed, migrate all the apps.
* `./manage.py migrate`

Now lets create a super user as an admin for the site. Run `./manage.py createsuperuser` and follow the prompts.

Once you have created a user, we can add some base data to the project. This will load some basic course and cuisine data into the project.
* `./manage.py loaddata course_data.json`
* `./manage.py loaddata cuisine_data.json`

If you want to add some test data we can load a few recipes and some news data. This data isn't really needed unless you just wanna see how the app looks and if its working.
* `./manage.py loaddata news_data.json`
* `./manage.py loaddata recipe_data.json`
* `./manage.py loaddata ing_data.json`
* `./manage.py loaddata direction_data.json`

Now we need to gather all the static fields for the django rest framework and django admin panel. Also, we need to build the default image for when recipes don't have an image.

* `./manage collectstatic`
* `./manage imgur`

That should be it! you can run the dev server now to load up the api `./manage runserver`.

Load up `http://localhost:8000/admin/` in a browser and see the results.

The next thing we need to do is setup react. The bundle and index are located in `frontend/public/` The bundle there is already a production copy. That should be used if your looking to just serve the project with, for example, nginx. However if you want node to serve the code. See below

From your base dir:
* `cd frontend`
* `npm install` (this will take a few minutes as its loading a ton of small static files)
* `NODE_ENV=production npm start`
* Load `http://localhost:8080` in a browse and see the results.

If you just want to test or play around with the code, you can run the dev server. First, make sure the django server is running. Then:
* `cd frontend`
* `npm install` (this will take a few minutes as its loading a ton of small static files)
* `npm start`
* Load `http://localhost:8080` in a browse and see the results.

# TODO

If you're looking for something to do, I'd love some help on the following:

* React i18n. I plan on having support for german at some point, but have no idea now i18n works in react.
* Tests (both for django and react)
* Working grocery list
* Editing Recipes (WYSIWYG)

# Dev Tips

All of the data (excluding recipes) can be added to the DB using the Django REST GUI. The following is the CURL post I use to add recipes to the DB quickly for testing. You'll will need to either add your auth token as a header or disable the auth check in `api/v1/recipe/seralizers.py`.

```bash
curl -X POST -H "Content-Type: application/json" http://localhost:8000/api/v1/recipe/recipes/ --data '{"info":"hi", "cook_time":"12", "title":"hi", "directions":[{"title":"do this first", "step":"1"}], "servings":"12", "cuisine":"1", "ingredients":[{"title":"first", "quantity":"2", "measurement":"tsp"}], "prep_time":"123", "course":"1", "tags":[{"author":"1", "title":"chicken"}]}'
```

Apps can access there API roots via there app names:
* Recipes - http://localhost:8000/api/v1/recipe
* Ingredients - http://localhost:8000/api/v1/ingredient/
* Recipe groups - http://localhost:8000/api/v1/recipe_groups/
* News - http://localhost:8000/api/v1/news/
* Lists - http://localhost:8000/api/v1/list/
10 changes: 4 additions & 6 deletions __init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
"""OpenEats"""
__version__ = '2.4'
__license__ = 'BSD License'
__version__ = '1.0'
__license__ = 'MIT License'

__author__ = 'Quenten Griffith'
__email__ = '[email protected]'

__url__ = 'http://oe2.openeats.org'
__author__ = 'Ryan Noelk'
__email__ = '[email protected]'
9 changes: 0 additions & 9 deletions accounts/admin.py

This file was deleted.

28 changes: 0 additions & 28 deletions accounts/fixtures/profile_data.json

This file was deleted.

50 changes: 0 additions & 50 deletions accounts/fixtures/test_friend_data.json

This file was deleted.

Loading

0 comments on commit e9a610c

Please sign in to comment.