Skip to content

Commit

Permalink
initial commit master
Browse files Browse the repository at this point in the history
  • Loading branch information
ivantaimal committed Oct 21, 2016
0 parents commit a69eb54
Show file tree
Hide file tree
Showing 815 changed files with 214,344 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# If you need to exclude files such as those generated by an IDE, use
# $GIT_DIR/info/exclude or the core.excludesFile configuration variable as
# described in https://git-scm.com/docs/gitignore

*.egg-info
*.pot
*.py[co]
.tox/
.idea
__pycache__
MANIFEST

docs/_build/
docs/locale/
node_modules/
tests/coverage_html/
tests/.coverage
build/
tests/report/
freeven/static
*.sqlite3
nazly.py
freeven/media

# compiled output

*/tmp

# dependencies
*/node_modules
*/bower_components

# misc
*/.sass-cache
*/connect.lock
*/coverage/*
*/libpeerconnection.log
*npm-debug.log
*testem.log

**/WebContent/node_modules/*
**/.idea/*
**/test/unit/reports/*
**/test/PhantomJS*
WebContent/dist/stats.json

**/WebContent/dist/production/stats.json
**/WebContent/dist/production/*.map
24 changes: 24 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
language: python
python:
- 3.5.2
install:
- pip install -r requirements.txt
script: nosetests
deploy:
provider: heroku
api_key:
secure: PekJe9FTfb38SeIkwTQOAIbdeyb9CKqKfj2A58lzeClyBVfpzhiW+zvAWbgywOaWHd4oyrJDyhwGg8zeZumBntiZKW9tIJDSAJz2ShUNtcWKuyDB66Z58uTINwkcP42G25VAPvqe2+6/kR5ls2g3TaV4im5vAzRIeGuuM97UPD/Z2Wg8mWhimtUWVmqHULksJh/NAHyOMXxsmaDxfh/pFN0Qb6JGQtjGezDdEG48XcauS9IeNaIJ8f5pWoJ+05WXrD5QHUdy9I+g0t4XXdmbhOiDHDSSR1JSyNNtjzSAzex+LylwrL+Tei22//6XzDn91RKIclbdgd6yp9zH2XqFGeRWQ5xer8qi8P6Y8GgSNeziaAMeSJ5/1KQA1tgWxnNWAXBwlUcnk4Ww1R6sJbHOOkao++emR4Dh6rZ1Scy5H/13B88r+4s6/iuyBNahXJS3GdfGOckPMsJ7iwbIU8GInR33WYejCLNu3yGSmzn/RlIaDK1SQCrCi7vvxIYC8FD22jYhs+i2v6p+b8O+jEF5kFyg7jwFoccAi9ZrXAjMbQHED2ThGdKQ3OEfzTzAfgM3HBEGWc/G9EJ7lyYg2xZpXQ8TUB6QEICk2j60Fe1wNFhzwPgYFzXc4vvUeuV3OcV/hBx8QHAGxo6q+tc9xh17CY5HXqklJEiyjXbAOs4onU8=
app:
# https://freeven-srv.herokuapp.com
master: freeven-srv
# https://freeven-srv-stg.herokuapp.com
stage: freeven-srv-stg
# https://freeven-srv-dev.herokuapp.com
development: freeven-srv-dev
on:
repo: Rocket-Team/Freeven-srv
run:
- python manage.py collectstatic --no-input --settings=freeven.settings.prod
notifications:
slack:
secure: Be/DLvDnNODxS52xn3+KBj2Q7O4WO7wYttcS6ZmvdbJKfPuzT0aa25l6NlcH9aFjBLQ5goODA3/hY+dSsiyBfKQLKh+toUn4+T5Rw42ilBPR0dcnzdHDwiPTTbvHABQLQYsuPbBwmrETYZCug9s5W4eevgxxx0TtLYtWXKCnBSwTzzVdRt0X0zuJOmovs3qOHMT1gJoXGb72Nx/toBcNwths00UdpZ3mG2lWTWjecjNKf+49uwqdUvMiKPtbGf+bDojgmVCb1jf1g0XwVu6U92GpOZNMMb4DRLwblsRTdYKYA8hddfDqNYSyBplHpfqlMRKonmMDLo5iD8O8aRI/hQZWBVk9m+5AguVN/akavJSbfZQ7b7UlkqkNmbUAoJFwmtrj4PkfGS4cCJMVzbtAvLvtnthevWsRMh7IRXxwoZQ1pGxqVZ3RHIRkFXOj0ddSSVlGtB5yDnW3blSH0ghRT3jCIgttd99IUyzdAEtLuQftzOmd7YB6UNn887+B930O0r822MJA3XlzYlvt1waay2lBr4IqQeOJ4WUvq0rFheCFay8NQsbVPLWB1UUSJR7qisRNtL/EQOrPoOeE2OWD6lyi5TXexcRy4OozZLhXAOdb0FKjhQTV06gC7oIHFdRVMojVkVbwP9gLgFogpayEmwqheMgWzbydYxnGVKvXLvw=
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: DJANGO_SETTINGS_MODULE=freeven.settings.prod gunicorn freeven.wsgi
21 changes: 21 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
###Freeven
###Clonar el repositorio y configurar los credenciales

```
git clone "https://github.com/Rocket-Team/Freeven-srv.git"
cd freeven
git config user.name "{{your user}}"
git config user.email "{{your email}}"
git config credential.helper store
git pull
```

###Demo:
https://freeven.herokuapp.com


### Para ejecutar en local
```
python manage.py runserver --settings=freeven.settings.dev
```
Empty file added freeven/__init__.py
Empty file.
8 changes: 8 additions & 0 deletions freeven/custom_storages.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from django.conf import settings
from storages.backends.s3boto import S3BotoStorage

class StaticStorage(S3BotoStorage):
location = settings.STATICFILES_LOCATION

class MediaStorage(S3BotoStorage):
location = settings.MEDIAFILES_LOCATION
Empty file added freeven/settings/__init__.py
Empty file.
123 changes: 123 additions & 0 deletions freeven/settings/base.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
import os

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'storages',
'rest_framework',
'rest_framework.authtoken',
'rest_framework_social_oauth2',
'oauth2_provider',
'social.apps.django_app.default',
'users',
'manager',
'tracks',
'web',
]

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

ROOT_URLCONF = 'freeven.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
BASE_DIR + '/../web/webcontent/dist/production/',
],
'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',
'social.apps.django_app.context_processors.backends',
'social.apps.django_app.context_processors.login_redirect',
],
},
},
]

WSGI_APPLICATION = 'freeven.wsgi.application'

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',
},
]

REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': (
'oauth2_provider.ext.rest_framework.OAuth2Authentication',
'rest_framework_social_oauth2.authentication.SocialAuthentication',
#'rest_framework.authentication.TokenAuthentication',
),
'DEFAULT_FILTER_BACKENDS': ('rest_framework.filters.DjangoFilterBackend',),
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination',
'PAGE_SIZE': 10
}

AUTHENTICATION_BACKENDS = (
#Django Auth
'django.contrib.auth.backends.ModelBackend',
# Facebook OAuth2
'social.backends.facebook.FacebookAppOAuth2',
'social.backends.facebook.FacebookOAuth2',
# GoogleOAuth2
'social.backends.google.GoogleOAuth2',
# django-rest-framework-social-oauth2
'rest_framework_social_oauth2.backends.DjangoOAuth2',
)

# Facebook configuration
SOCIAL_AUTH_FACEBOOK_KEY = os.environ['FACEBOOK_KEY']
SOCIAL_AUTH_FACEBOOK_SECRET = os.environ['FACEBOOK_SECRET']

# Google+ configuration
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = os.environ['GOOGLE_OAUTH2_KEY']
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = os.environ['GOOGLE_OAUTH2_SECRET']

# Define SOCIAL_AUTH_FACEBOOK_SCOPE to get extra permissions from facebook.
#Email is not sent by default, to get it, you must request the email permission:
SOCIAL_AUTH_FACEBOOK_SCOPE = ['email']

LANGUAGE_CODE = 'es-co'

TIME_ZONE = 'America/Bogota'

USE_I18N = True

USE_L10N = True

USE_TZ = True

LOGIN_REDIRECT_URL = '/manager/'
LOGIN_URL = '/manager/login/'

STATICFILES_DIRS = [
('production', BASE_DIR + '/../web/webcontent/dist/production'),
]
23 changes: 23 additions & 0 deletions freeven/settings/dev.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from .base import *

SECRET_KEY = os.environ['SECRET_KEY']

DEBUG = True

ALLOWED_HOSTS = []

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': os.environ['DATABASE_NAME'],
'USER': os.environ['DATABASE_USER'],
'PASSWORD': os.environ['DATABASE_PASSWORD'],
'HOST': os.environ['DATABASE_HOST'],
'PORT': os.environ['DATABASE_PORT'],
}
}

STATIC_URL = '/static/'

MEDIA_URL= '/media/'
MEDIA_ROOT = BASE_DIR + '/media/'
33 changes: 33 additions & 0 deletions freeven/settings/prod.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from .base import *

SECRET_KEY = os.environ['SECRET_KEY']

DEBUG = True

ALLOWED_HOSTS = []

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': os.environ['DATABASE_NAME'],
'USER': os.environ['DATABASE_USER'],
'PASSWORD': os.environ['DATABASE_PASSWORD'],
'HOST': os.environ['DATABASE_HOST'],
'PORT': os.environ['DATABASE_PORT'],
}
}

AWS_PRELOAD_METADATA=True
AWS_STORAGE_BUCKET_NAME = os.environ['AWS_STORAGE_BUCKET_NAME']
AWS_ACCESS_KEY_ID = os.environ['AWS_ACCESS_KEY_ID']
AWS_SECRET_ACCESS_KEY = os.environ['AWS_SECRET_ACCESS_KEY']
AWS_S3_CUSTOM_DOMAIN = '%s.s3.amazonaws.com' % AWS_STORAGE_BUCKET_NAME
AWS_S3_HOST = os.environ['AWS_S3_HOST']

STATICFILES_LOCATION = 'static'
STATICFILES_STORAGE = 'freeven.custom_storages.StaticStorage'
STATIC_URL = "https://%s/%s/" % (AWS_S3_CUSTOM_DOMAIN, STATICFILES_LOCATION)

MEDIAFILES_LOCATION = 'media'
MEDIA_URL = "https://%s/%s/" % (AWS_S3_CUSTOM_DOMAIN, MEDIAFILES_LOCATION)
DEFAULT_FILE_STORAGE = 'freeven.custom_storages.MediaStorage'
21 changes: 21 additions & 0 deletions freeven/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from django.conf.urls import url, include
from django.contrib import admin
from django.conf import settings

urlpatterns = [
url(r'^', include('web.urls')),
url(r'^admin/', admin.site.urls),
url(r'^manager/', include('manager.urls')),
url(r'^track/', include('tracks.urls')),
url(r'^api/track/', include('tracks.urls')),
url(r'^user/', include('users.urls')),
url(r'^api/user', include('users.urls')),
url(r'^auth/', include('rest_framework_social_oauth2.urls')),
# # BaseView is a static html
# url(r'^about/', HomeView.as_view()), # HomeView is an Ember Single Page Application
# url(r'^home/', HomeView.as_view()), # HomeView is an Ember Single Page Application
]

if settings.DEBUG:
from django.conf.urls.static import static
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
16 changes: 16 additions & 0 deletions freeven/wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
WSGI config for freeven 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.10/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

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

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

if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "freeven.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
# issue is really that Django is missing to avoid masking other
# exceptions on Python 2.
try:
import django
except ImportError:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
)
raise
execute_from_command_line(sys.argv)
Empty file added manager/__init__.py
Empty file.
3 changes: 3 additions & 0 deletions manager/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.
5 changes: 5 additions & 0 deletions manager/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.apps import AppConfig


class ManagerConfig(AppConfig):
name = 'manager'
3 changes: 3 additions & 0 deletions manager/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.db import models

# Create your models here.
Loading

0 comments on commit a69eb54

Please sign in to comment.