Skip to content

Commit

Permalink
Merge 8232d58 into aba968d
Browse files Browse the repository at this point in the history
  • Loading branch information
Nwuguru Sunday committed Jul 20, 2016
2 parents aba968d + 8232d58 commit 75bd1da
Show file tree
Hide file tree
Showing 152 changed files with 128,115 additions and 2 deletions.
1 change: 1 addition & 0 deletions .coverage
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!coverage.py: This is a private format, don't read it directly!{"lines": {"/Users/andela/Documents/projects/django-app/photo-editing/app/photos/api/__init__.py": [1], "/Users/andela/Documents/projects/django-app/photo-editing/app/photos/views.py": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 24, 27, 60], "/Users/andela/Documents/projects/django-app/photo-editing/app/photos/api/urls.py": [1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17], "/Users/andela/Documents/projects/django-app/photo-editing/app/photos/api/image_edit.py": [1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176], "/Users/andela/Documents/projects/django-app/photo-editing/app/photos/api/image_processor.py": [1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71], "/Users/andela/Documents/projects/django-app/photo-editing/app/photos/api/permissions.py": [1, 4, 6, 7], "/Users/andela/Documents/projects/django-app/photo-editing/app/photos/api/serializers.py": [1, 2, 3, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 59, 60, 61, 62, 64, 65, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 98, 99, 102, 103, 104, 105, 106, 108, 109, 111, 112, 114, 115, 116, 118, 119], "/Users/andela/Documents/projects/django-app/photo-editing/app/photos/api/views.py": [1, 2, 3, 4, 5, 6, 7, 11, 12, 15, 16, 19, 20, 21, 22, 24, 25, 26, 27, 28, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 88, 99, 101, 102, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 118, 128, 130, 131, 134, 135, 136, 137, 138, 139, 140, 141, 143, 144, 148, 149, 150, 151, 152, 153, 154, 156, 157, 159, 160, 161, 162, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 191, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 215, 216, 217, 218, 219, 220, 221, 222, 223, 225, 226, 227, 229, 230, 231, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 245, 246, 247, 248]}}
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*.pyc
.env.py
.env.yml
db.sqlite3
__pycache__
app/app/develop.py
app/static_cdn/*
app/media/*
node_modules
5 changes: 5 additions & 0 deletions .profile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
python app/manage.py makemigrations
python app/manage.py migrate
mkdir app/media
mkdir app/media/main
mkdir app/media/edited
11 changes: 11 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
language: python
python:
- "2.7"
# command to install dependencies
install:
- pip install -r requirements.txt
script:
- cd app
- python manage.py test
after_success:
- coveralls
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: gunicorn app.wsgi --pythonpath=app --log-file=-
82 changes: 80 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,80 @@
# bucketlist-django
According to Merriam-Webster Dictionary, a Bucket List is a list of things that one has not done before but wants to do before dying.
# Django Powered Photo Editor

photo-editing
[![Coverage Status](https://coveralls.io/repos/github/andela-snwuguru/photo-editing/badge.svg?branch=master)](https://coveralls.io/github/andela-snwuguru/photo-editing?branch=master) [![Build Status](https://travis-ci.org/andela-snwuguru/photo-editing.svg?branch=master)](https://travis-ci.org/andela-snwuguru/photo-editing)

Image speaks louder than voice. Photo editor gives you the opportunity to express your creativity and share it with the world.

### Technology used

- Django - Easy and faster way to build better web applications.
- Djangorestframework - Django REST framework is a powerful and flexible toolkit for building Web APIs in Django powered apps.
- React JS - A JavaScript library for building user interfaces
- Bootstrap - A powerful mobile first front-end framework for faster and easier web development.

### Features
Photo editor provides you with several image manipulation options

- Enhance image brightness, contrast, color and sharpness
- Apply filters such as blur, contour, edge enhancement, emboss etc.
- Transform tools such as flip and rotate
- Effects such as colorize, posterize, quantize and more

### How to use

To install and run this application locally, you need to have python installed on your machine.

#### Installation

To install the build locally

- `` $ git clone https://github.com/andela-snwuguru/photo-editing.git ``
- `` $ cd photo-editing ``
- `` $ pip install -r requirements.txt ``

#### Set Up your environment key

#### photo-editing/app/app/develop.py

Develop.py file is required to get the database configuration. See content below
```
import os, sys
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
SECRET_KEY = 'your secret key here'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'testdb.sqlite3') if 'test' in sys.argv else os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
DEBUG = True
```

#### photo-editing/.env.py
.env.py file is also required to configure secured information. See content below.

```
SECRET_KEY = "your-secret-code"
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = 'oauth2 key from google'
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = 'oauth2 secret from google'
SOCIAL_AUTH_FACEBOOK_KEY = 'app id'
SOCIAL_AUTH_FACEBOOK_SECRET = 'app secret'
SOCIAL_AUTH_TWITTER_KEY = 'customer key'
SOCIAL_AUTH_TWITTER_SECRET = 'customer secret'
```

#### Run your build

`` $ python app/manage.py makemigrations ``
`` $ python app/manage.py migrate ``
`` $ python app/manage.py runserver ``

#### Running the test

`` $ cd app && python manage.py test ``

### How to Contribute

This is an open source project, feel free to fork the repo, add functionality to the project and raise a pull request.
1 change: 1 addition & 0 deletions app/.coverage
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!coverage.py: This is a private format, don't read it directly!{"lines": {"/Users/andela/Documents/projects/django-app/photo-editing/app/photos/api/__init__.py": [1], "/Users/andela/Documents/projects/django-app/photo-editing/app/photos/views.py": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 13, 14, 15, 16, 18, 20, 21, 22], "/Users/andela/Documents/projects/django-app/photo-editing/app/photos/api/urls.py": [1, 2, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "/Users/andela/Documents/projects/django-app/photo-editing/app/photos/api/image_edit.py": [1, 2, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 19, 20, 22, 23, 24, 25, 26, 27, 31, 32, 34, 36, 38, 40, 42, 44, 45, 47, 49, 51, 53, 55, 57, 58, 59, 60, 61, 63, 65, 66, 67, 69, 71, 72, 74, 76, 77, 78, 80, 82, 83, 84, 86, 88, 90, 92, 93, 94, 96, 98, 99, 101, 103, 104, 106, 110, 113, 116, 118, 120, 122, 124, 128, 135, 140, 145, 146, 147, 148, 150, 151, 152], "/Users/andela/Documents/projects/django-app/photo-editing/app/photos/api/image_processor.py": [1, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 16, 17, 19, 20, 21, 23, 24, 25, 27, 28, 29, 31, 32, 33, 34, 35, 37, 38, 39, 40, 41], "/Users/andela/Documents/projects/django-app/photo-editing/app/photos/api/permissions.py": [1, 4, 6, 7], "/Users/andela/Documents/projects/django-app/photo-editing/app/photos/api/serializers.py": [1, 2, 3, 9, 10, 13, 15, 16, 18, 19, 20, 21, 22, 23, 25, 27, 28, 29, 30, 32, 33, 34, 37, 38, 39, 40, 42, 43, 44, 45, 46, 47, 49, 50, 53, 54, 55, 56, 59, 62, 64, 65, 67, 68, 69, 70, 71, 73, 74, 77, 78, 79, 80, 81, 83, 84, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 98, 99, 102, 103, 104, 105, 106, 108, 109, 111, 112, 114, 115, 116, 118, 119], "/Users/andela/Documents/projects/django-app/photo-editing/app/photos/api/views.py": [1, 2, 3, 4, 5, 6, 11, 15, 19, 20, 21, 22, 24, 25, 26, 27, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 47, 48, 51, 52, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 69, 70, 71, 72, 73, 74, 75, 76, 77, 79, 80, 83, 99, 101, 102, 105, 106, 108, 109, 110, 112, 128, 130, 131, 134, 135, 136, 137, 138, 139, 141, 143, 144, 148, 149, 150, 151, 152, 153, 154, 156, 157, 160, 178, 179, 180, 181, 182, 186, 204, 205, 206, 207, 208, 211, 229, 230, 231, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 246, 247, 248]}}
Empty file added app/app/__init__.py
Empty file.
18 changes: 18 additions & 0 deletions app/app/production.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import os, sys
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
import dj_database_url

if 'test' in sys.argv:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'testdb.sqlite3'),
}
}
SECRET_KEY = "test-secret"
DEBUG = True
else:
DATABASES = {
'default': dj_database_url.config()
}
DEBUG = True
161 changes: 161 additions & 0 deletions app/app/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
"""
Django settings for bucketlist project.
Generated by 'django-admin startproject' using Django 1.9.2.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""

import os
from django_envie.workroom import convertfiletovars
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
convertfiletovars()
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = os.getenv('SECRET_KEY')

SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')

ALLOWED_HOSTS = ['*']
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = os.getenv('SOCIAL_AUTH_GOOGLE_OAUTH2_KEY')
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = os.getenv('SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET')
SOCIAL_AUTH_FACEBOOK_KEY = os.getenv('SOCIAL_AUTH_FACEBOOK_KEY')
SOCIAL_AUTH_FACEBOOK_SECRET = os.getenv('SOCIAL_AUTH_FACEBOOK_SECRET')
SOCIAL_AUTH_FACEBOOK_SCOPE = ['email']
SOCIAL_AUTH_TWITTER_KEY = os.getenv('SOCIAL_AUTH_TWITTER_KEY')
SOCIAL_AUTH_TWITTER_SECRET = os.getenv('SOCIAL_AUTH_TWITTER_SECRET')
SOCIAL_AUTH_LOGIN_REDIRECT_URL = '/'
SOCIAL_AUTH_LOGIN_URL = '/'
DEBUG = True

try:
from .development import *
except ImportError:
from .production import *

# Application definition

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
'social.apps.django_app.default',
'django_nose',
'photos',
]


# Use nose to run all tests
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'

NOSE_ARGS = [
'--with-coverage',
'--cover-package=photos.api,photos.views',
]

REST_FRAMEWORK = {
'DEFAULT_PERMISSION_CLASSES': (
'rest_framework.permissions.IsAuthenticated',
),
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework.authentication.SessionAuthentication',
'rest_framework.authentication.BasicAuthentication',
),
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
'PAGE_SIZE': 8,
}

MIDDLEWARE_CLASSES = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

AUTHENTICATION_BACKENDS = (
'social.backends.facebook.FacebookOAuth2',
'social.backends.google.GoogleOAuth2',
'social.backends.twitter.TwitterOAuth',
'django.contrib.auth.backends.ModelBackend',
)

ROOT_URLCONF = 'app.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [BASE_DIR+'/templates'],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]

WSGI_APPLICATION = 'app.wsgi.application'


# Password validation
# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]


# Internationalization
# https://docs.djangoproject.com/en/1.9/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.9/howto/static-files/
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)

STATIC_URL = '/static/'
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')]
STATIC_ROOT = os.path.join(BASE_DIR, 'static_cdn')
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
33 changes: 33 additions & 0 deletions app/app/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""bucketlist URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
"""
from django.conf import settings
from django.conf.urls.static import static
from django.conf.urls import url, include
from django.contrib import admin
from photos import views

urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^$', views.index),
url('', include('social.apps.django_app.urls', namespace='social')),
url(r'^logout/$', views.logout_view),
url(r'^download/$', views.download),
url(r'^api/v1/', include('photos.api.urls', namespace="api")),
]

if settings.DEBUG:
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
19 changes: 19 additions & 0 deletions app/app/wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"""
WSGI config for bucketlist project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "app.settings")

application = get_wsgi_application()

from whitenoise.django import DjangoWhiteNoise
application = DjangoWhiteNoise(application)
10 changes: 10 additions & 0 deletions app/manage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env python
import os
import sys

if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "app.settings")

from django.core.management import execute_from_command_line

execute_from_command_line(sys.argv)
Empty file added app/photos/__init__.py
Empty file.
3 changes: 3 additions & 0 deletions app/photos/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
Empty file added app/photos/api/__init__.py
Empty file.
Loading

0 comments on commit 75bd1da

Please sign in to comment.