Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Developer #4

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 116 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# dotenv
.env

# virtualenv
.venv
venv/
ENV/
decide-ws/
decideEnv/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/

.vagrant
.gitmessage.txt

/local_settings.py

#Readme
README.md

# macOS
.DS_Store

#node_modules for angular app
node_modules/
26 changes: 26 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
dist: xenial
services:
- postgresql
addons:
postgresql: '9.4'
before_script:
- psql -U postgres -c "create user decide password 'decide'"
- psql -U postgres -c "create database test_decide owner decide"
- psql -U postgres -c "ALTER USER decide CREATEDB"
language: python
python:
- '3.6'
install:
- pip install -r requirements.txt
script:
- cd decide
- cp travis_local_settings.py local_settings.py
- python /.manage.py test store
- rm local_settings.py
- cd ..
deploy:
provider: heroku
app: decideexamen
strategy: git
api_key:
secure: Nq6ve+dmfmHMXzElTg1YMUVIWsp9ncgp1z4Ghy3T9UbOa1NkYGkbz8YlDyeFRzEeSK6Ks2ZwDAA1RC/E9ieTXGXHJ30uwAQOEkCoI9N8Z3HzxIEjyoCM+YJWl57g5r0jjxAMo12TcthfWInCXmt9gQHHXGkc85Nw8t+St0veSKCoLry2Sygb6i29spr4z36NPq+eAHojwHQFg2T8BxXZfvxfPmiaA5c9UkIfOvk+cgZhCP46K+XoNO5Z7d5Qly7au32zvXka3Qhf0FH5dhTnOA6JA2iTEzXhF6OUaCeBb3olGbQl+s05UdFwu+GLhnoYYD7+MTxwky4iU1M1Wocu/g063BPpg3Z/NGQ2qdnaryLJlsdEd2Cobb9y/6c7wu/mbqHMUxkZHFNyDuYtl18C0nkXXCzy+C+E1dBcjo2Ym25du85VQ7id4MrPLyP4YLBSrLQLdsictJ+bAv8/+ouzl00nBYSD2e0//qWgKAVequr11fF1NNmk0qMi5blcr49GSJ7SLh8AkhrJmeKfLrZkV9bTKeIjhFBnrv2359uX7AwEW3j8nQlRokXzdOVwi2ZIb2Pfz1NCttyCCYfUL1rLDn+g6MpMQJ5mcEzTHlpVJfkr3ADFDBq7COnK6gOp0TdNbRgzGr5mkq7kYsGAjY0XTaV94+wfwNIML/usVv/M0s0=
4 changes: 4 additions & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
% prepara el repositorio para su despliegue.
release: sh -c 'cd decide && python manage.py migrate'
% especifica el comando para lanzar Decide
web: sh -c 'cd decide && gunicorn --graceful-timeout=900 --timeout 900 decide.wsgi --log-file -'
40 changes: 34 additions & 6 deletions decide/decide/settings.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
"""
Django settings for decide project.

Generated by 'django-admin startproject' using Django 2.0.

For more information on this file, see
https://docs.djangoproject.com/en/2.0/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.0/ref/settings/
"""

import os
#import django_heroku

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
Expand Down Expand Up @@ -68,7 +66,20 @@
'voting',
]

BASEURL = 'http://localhost:8000'
#BASEURL = 'http://localhost:8000'
BASEURL = 'https://decideexamen.herokuapp.com/'

APIS = {
'authentication': BASEURL,
'base': BASEURL,
'booth': BASEURL,
'census': BASEURL,
'mixnet': BASEURL,
'postproc': BASEURL,
'store': BASEURL,
'visualizer': BASEURL,
'voting': BASEURL,
}

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
Expand Down Expand Up @@ -106,8 +117,12 @@

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'decide',
'USER': 'decide',
'PASSWORD': 'decide',
'HOST': 'localhost',
'PORT': '5432'
}
}

Expand Down Expand Up @@ -153,10 +168,23 @@
# number of bits for the key, all auths should use the same number of bits
KEYBITS = 256

# Versioning
ALLOWED_VERSIONS = ['v1', 'v2']
DEFAULT_VERSION = 'v1'

try:
from local_settings import *
except ImportError:
print("local_settings.py not found")

# loading jsonnet config
if os.path.exists("config.jsonnet"):
import json
from _jsonnet import evaluate_file
config = json.loads(evaluate_file("config.jsonnet"))
for k, v in config.items():
vars()[k] = v


INSTALLED_APPS = INSTALLED_APPS + MODULES
django_heroku.settings(locals())
42 changes: 42 additions & 0 deletions decide/local_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
ALLOWED_HOSTS = ["*"]

# Modules in use, commented modules that you won't use
MODULES = [
'authentication',
'base',
'booth',
'census',
'mixnet',
'postproc',
'store',
'visualizer',
'voting',
]

APIS = {
'authentication': 'http://localhost:8000',
'base': 'http://localhost:8000',
'booth': 'http://localhost:8000',
'census': 'http://localhost:8000',
'mixnet': 'http://localhost:8000',
'postproc': 'http://localhost:8000',
'store': 'http://localhost:8000',
'visualizer': 'http://localhost:8000',
'voting': 'http://localhost:8000',
}

BASEURL = 'http://localhost:8000'

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'postgres',
'USER': 'decide',
'HOST': '127.0.0.1',
'PASSWORD': 'decide',
'PORT': '5432',
}
}

# number of bits for the key, all auths should use the same number of bits
KEYBITS = 256
41 changes: 41 additions & 0 deletions decide/travis_local_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
ALLOWED_HOSTS = ["*"]

# Modules in use, commented modules that you won't use
MODULES = [
'authentication',
'base',
'booth',
'census',
'mixnet',
'postproc',
'store',
'visualizer',
'voting',
]

APIS = {
'authentication': 'http://localhost:8000',
'base': 'http://localhost:8000',
'booth': 'http://localhost:8000',
'census': 'http://localhost:8000',
'mixnet': 'http://localhost:8000',
'postproc': 'http://localhost:8000',
'store': 'http://localhost:8000',
'visualizer': 'http://localhost:8000',
'voting': 'http://localhost:8000',
}

BASEURL = 'http://10.5.0.1:8000'

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'postgres',
'USER': 'postgres',
'HOST': 'localhost',
'PORT': '5432',
}
}

# number of bits for the key, all auths should use the same number of bits
KEYBITS = 256
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ RUN pip install ipython

WORKDIR /app

RUN git clone https://github.com/wadobo/decide.git .
RUN git clone https://github.com/jesushd103/EGC-1819-830.git .
RUN pip install -r requirements.txt

WORKDIR /app/decide
Expand Down
20 changes: 10 additions & 10 deletions docker/docker-settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@
'voting',
]

BASEURL = 'http://10.5.0.1:8000'
BASEURL = 'http://localhost:8000'

APIS = {
'authentication': 'http://10.5.0.1:8000',
'base': 'http://10.5.0.1:8000',
'booth': 'http://10.5.0.1:8000',
'census': 'http://10.5.0.1:8000',
'mixnet': 'http://10.5.0.1:8000',
'postproc': 'http://10.5.0.1:8000',
'store': 'http://10.5.0.1:8000',
'visualizer': 'http://10.5.0.1:8000',
'voting': 'http://10.5.0.1:8000',
'authentication': 'http://localhost:8000',
'base': 'http://localhost:8000',
'booth': 'http://localhost:8000',
'census': 'http://localhost:8000',
'mixnet': 'http://localhost:8000',
'postproc': 'http://localhost:8000',
'store': 'http://localhost:8000',
'visualizer': 'http://localhost:8000',
'voting': 'http://localhost:8000',
}
8 changes: 7 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
Django==2.0
django-heroku
gunicorn
pycryptodome==3.6.6
djangorestframework==3.7.7
django-cors-headers==2.1.0
requests==2.18.4
django-filter==1.1.0
psycopg2==2.7.4
psycopg2==2.8.4
django-rest-swagger==2.2.0
coverage==4.5.2
django-nose==1.4.6
jsonnet==0.12.1