Commit 47c0f584 authored by bhmeyer's avatar bhmeyer

Merge branch 'development' into 'master'

Sync Development and Master

See merge request !67
parents cc3383e8 af8f1833
Pipeline #19594 passed with stage
in 2 minutes and 13 seconds
*/.vscode/
.vscode/
# info de contas criadas no sistema
login_info
# base de dados
......@@ -10,6 +13,9 @@ src/cache
*.json
base_dados/*
base_dados
*/~lock.*
!./src/submission/analysis/test/historico.xls
!./src/submission/analysis/test/matricula.xls
src/.coverage
......@@ -28,3 +34,94 @@ static/*
**/__pycache__
*.ipynb
# Created by https://www.gitignore.io
### OSX ###
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear on external disk
.Spotlight-V100
.Trashes
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
# C extensions
*.so
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
lib/
lib64/
parts/
sdist/
var/
*.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
.cache
nosetests.xml
coverage.xml
# Translations
*.mo
*.pot
# Sphinx documentation
docs/_build/
# PyBuilder
target/
### Django ###
*.log
*.pot
*.pyc
__pycache__/
local_settings.py
.env
db.sqlite3
#image: ubuntu:16.04
variables:
POSTGRES_USER: "adega"
POSTGRES_PASSWORD: "adega"
POSTGRES_DB: "adega"
POSTGRES_HOST: "postgres"
POSTGRES_PORT: "5432"
VERSION: "DEVELOPMENT"
services:
- postgres:9.6
before_script:
- export LC_ALL=C.UTF-8
- export LANG=C.UTF-8
# - apt-get update -qq
# - apt-get install -y make
# - make install
# - make install-user
#- pip3 install -U pip setuptools pipenv==9.0.3
## pip3 --version
#- pipenv install
#- source $(pipenv --venv)/bin/activate
# - pipenv shell
# - python --version
# - pip3 show django | grep Version
django-tests:
tags:
- ubuntu
- regular
script:
- cd src
# - python manage.py makemigrations degree
# - python manage.py makemigrations educator
# - python manage.py makemigrations upload
# - python manage.py migrate
#- python manage.py test
# apt-get --quiet=2 não é efetivo, com >> /dev/null só mostra erros da saída
# stderr
- apt-get update --assume-yes >> /dev/null
- apt-get install --assume-yes python3-pip libpq-dev postgresql-client >> /dev/null
- pip3 install --quiet -r requirements.txt
- pip3 show django | grep Version
django-tests:
tags:
- ubuntu
- regular
script:
- cd src
- python3 manage.py makemigrations degree
- python3 manage.py makemigrations educator
- python3 manage.py makemigrations submission
- python3 manage.py makemigrations student
- python3 manage.py makemigrations admission
- python3 manage.py migrate
- python3 manage.py test
......@@ -60,7 +60,7 @@ Enquanto o `sudo make docker-up` estiver sendo executado, as alterações feitas
Assim como é possível realizar qualquer comando como seria feito no com o manage.py, também é possível por meio do comando `sudo make docker-manage`. Por exemplo:
```bash
$ sudo make docker-manage makemigrations uploads
$ sudo make docker-manage makemigrations submission
$ sudo make docker-manage migrate
$ sudo make docker-manage createsuperuser
```
......
token=token
pg_user=db_user
pg_password=db_pass
pg_database=db_name
version: '3'
services:
db:
container_name: adega_db_1
container_name: adega_db
image: postgres
environment:
- POSTGRES_USER=adega
- POSTGRES_PASSWORD=adega
- POSTGRES_DB=adega
web:
container_name: adega_web_1
container_name: adega_web
build:
context: .
dockerfile: ./docker_scripts/Dockerfile
......@@ -25,5 +25,5 @@ services:
- POSTGRES_USER=adega
- POSTGRES_PASSWORD=adega
- POSTGRES_DB=adega
- POSTGRES_HOST=adega_db_1
- POSTGRES_HOST=adega_db
- VERSION=DEVELOPMENT
version: '3'
services:
db:
restart: always
image: postgres
environment:
- POSTGRES_USER=adega
- POSTGRES_PASSWORD=adega
- POSTGRES_DB=adega
- POSTGRES_USER=${pg_user}
- POSTGRES_PASSWORD=${pg_password}
- POSTGRES_DB=${pg_database}
web:
restart: always
build:
context: .
dockerfile: ./docker_scripts/Dockerfile
......@@ -20,20 +22,23 @@ services:
depends_on:
- db
environment:
- POSTGRES_USER=adega
- POSTGRES_PASSWORD=adega
- POSTGRES_DB=adega
- POSTGRES_USER=${pg_user}
- POSTGRES_PASSWORD=${pg_password}
- POSTGRES_DB=${pg_database}
- POSTGRES_HOST=adega_db_1
#- SECRET_KEY=${token}
- VERSION=PRODUCTION
nginx:
restart: always
build: ./nginx/
ports:
- "8000:80"
- "80:80"
- "443:443"
depends_on:
- web
links:
- web:web
volumes:
- ./static:/adega/static
- /etc/ssl:/ssl
......@@ -2,6 +2,6 @@
# If ANY of this commands fails (return != 0) the container will be down
bash ./docker_scripts/wait_for_postgres.sh
cd src
python manage.py makemigrations degree admission educator uploads course
python manage.py makemigrations degree admission educator submission course
python manage.py migrate
python manage.py runserver 0.0.0.0:8000
......@@ -2,7 +2,7 @@
# If ANY of this commands fails (return != 0) the container will be down
bash ./docker_scripts/wait_for_postgres.sh
cd src
python manage.py makemigrations degree admission educator uploads course
python manage.py makemigrations degree admission educator submission course
python manage.py migrate
python manage.py collectstatic --noinput
......
......@@ -47,7 +47,7 @@ docker-production:
docker-compose --project-directory . -f docker_scripts/docker-production.yml -p adega up
docker-remove-all:
docker rm adega_web_1 adega_db_1
docker rm adega_web adega_db_1
docker rmi adega_web
......@@ -68,6 +68,6 @@ args = `arg="$(filter-out $@,$(MAKECMDGOALS))" && echo $${arg:-${1}}`
docker-manage:
@echo $(call args,"")
docker exec -it adega_web_1 bash -c "cd src; python3 manage.py $(call args,'')"
docker exec -it adega_web bash -c "cd src; python3 manage.py $(call args,'')"
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##
upstream adega {
server unix:/var/www/adega/adega.sock fail_timeout=10;
}
# Default server configuration
#
server {
listen 80 default_server;
listen [::]:80 default_server;
# Redirect all HTTP requests to HTTPS with a 301 Moved Permanently response.
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
charset utf-8;
# certs sent to the client in SERVER HELLO are concatenated in ssl_certificate
ssl_certificate /etc/ssl/adega/adega.crt;
ssl_certificate_key /etc/ssl/adega/adega.key;
ssl_session_timeout 1d;
ssl_session_cache shared:SSL:50m;
ssl_session_tickets off;
# modern configuration. tweak to your needs.
ssl_protocols TLSv1.2;
ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';
ssl_prefer_server_ciphers on;
# HSTS (ngx_http_headers_module is required) (15768000 seconds = 6 months)
add_header Strict-Transport-Security max-age=15768000;
# OCSP Stapling ---
# fetch OCSP records from URL in ssl_certificate and cache them
ssl_stapling on;
ssl_stapling_verify on;
## verify chain of trust of OCSP response using Root CA and Intermediate certs
#ssl_trusted_certificate /path/to/root_CA_cert_plus_intermediates;
# resolver <IP DNS resolver>;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
autoindex on;
try_files $uri $uri/ =404;
disable_symlinks off;
}
location /adega {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
include proxy_params;
proxy_redirect off;
proxy_pass http://adega/;
}
location /adega/static {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
root /var/www;
autoindex on;
try_files $uri $uri/ =404;
disable_symlinks on;
}
location ~ /\.ht {
deny all;
}
}
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##
upstream adega {
server unix:/var/www/adega/adega.sock fail_timeout=10;
}
# Default server configuration
#
server {
listen 80 default_server;
listen [::]:80 default_server;
# Redirect all HTTP requests to HTTPS with a 301 Moved Permanently response.
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
charset utf-8;
# certs sent to the client in SERVER HELLO are concatenated in ssl_certificate
ssl_certificate /etc/ssl/adega/adega.crt;
ssl_certificate_key /etc/ssl/adega/adega.key;
ssl_session_timeout 1d;
ssl_session_cache shared:SSL:50m;
ssl_session_tickets off;
# modern configuration. tweak to your needs.
ssl_protocols TLSv1.2;
ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';
ssl_prefer_server_ciphers on;
# HSTS (ngx_http_headers_module is required) (15768000 seconds = 6 months)
add_header Strict-Transport-Security max-age=15768000;
# OCSP Stapling ---
# fetch OCSP records from URL in ssl_certificate and cache them
ssl_stapling on;
ssl_stapling_verify on;
## verify chain of trust of OCSP response using Root CA and Intermediate certs
#ssl_trusted_certificate /path/to/root_CA_cert_plus_intermediates;
# resolver <IP DNS resolver>;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
autoindex on;
try_files $uri $uri/ =404;
disable_symlinks off;
}
location /adega {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
include proxy_params;
proxy_redirect off;
proxy_pass http://adega/;
}
location /adega/static {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
root /var/www;
autoindex on;
try_files $uri $uri/ =404;
disable_symlinks on;
}
location ~ /\.ht {
deny all;
}
}
server {
listen 80 default_server;
server_name adega.c3sl.ufpr.br;
return 301 https://$host$request_uri;
}
server {
listen 443;
ssl on;
server_name adega.c3sl.ufpr.br;
ssl_certicate /ssl/certs/c3sl.pem;
ssl_certificate_key /ssl/private/c3sl.pem;
listen 80;
server_name localhost;
charset utf-8;
client_max_body_size 100M;
......
from django.core.management.base import BaseCommand
from uploads.models import Submission
from submission.models import Submission
from script.main import analyze
from submission.analysis.main import analyze
class Command(BaseCommand):
......
"""
Django settings for uploads project.
Django settings for submission project.
Generated by 'django-admin startproject' using Django 1.9.8.
......@@ -12,9 +12,8 @@ https://docs.djangoproject.com/en/1.9/ref/settings/
import os
from django.contrib import messages
env = os.environ.copy()
import os
print()
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
......@@ -24,8 +23,7 @@ PROJECT_DIR = os.path.join(BASE_DIR, '..')
# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'e#-^aknk(5k)ej6rh#h$i(%h(m9)-j*lwrc_1dxnk=a@-mixlt'
SECRET_KEY = env.get("SECRET_KEY", 'e#-^aknk(5k)ej6rh#h$i(%h(m9)-j*lwrc_1dxnk=a@-mixlt'),
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = os.environ['VERSION'] == "DEVELOPMENT"
......@@ -43,6 +41,7 @@ INSTALLED_APPS = [
'django.contrib.staticfiles',
'django_extensions',
'widget_tweaks',
'guardian',
'adega',
'public',
......@@ -52,7 +51,7 @@ INSTALLED_APPS = [
'course',
'student',
'report_api',
'uploads'
'submission'
]
MIDDLEWARE_CLASSES = [
......@@ -102,17 +101,21 @@ WSGI_APPLICATION = 'adega.wsgi.application'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'adega',
'USER': 'adega',
'PASSWORD': 'adega',
'HOST': 'adega_db_1',
'PORT': '5432',
'NAME': env.get("POSTGRES_DB", "adega"),
'USER': env.get("POSTGRES_USER", "adega"),
'PASSWORD': env.get("POSTGRES_PASSWORD", "adega"),
'HOST': env.get("POSTGRES_HOST", "adega_db_1"),
'PORT': env.get("POSTGRES_PORT", "5432")
}
}
AUTHENTICATION_BACKENDS = [
'public.auth.EmailBackend',
'guardian.backends.ObjectPermissionBackend',
AUTHENTICATION_BACKENDS = ['public.auth.EmailBackend']
]
ANONYMOUS_USER_NAME = "Público"
LOGIN_URL = 'public:index'
......@@ -170,7 +173,7 @@ else:
STATIC_ROOT = os.path.join(PROJECT_DIR, 'static')
MEDIA_URL = '/script/base/'
MEDIA_ROOT = os.path.join(PROJECT_DIR, 'uploads')
MEDIA_ROOT = os.path.join(PROJECT_DIR, 'submission')
# MEDIA_URL = None # a gente não quer ninguem fazendo download disso
# MEDIA_ROOT = os.path.join(PROJECT_DIR, 'uploads')
# MEDIA_ROOT = os.path.join(PROJECT_DIR, 'submission')
......@@ -93,8 +93,7 @@ footer h3 {
padding:0;
}
.sidebar li,
.sidebar li div {
.nav-item {
display: flex;
}
......
......@@ -12,7 +12,14 @@ class AdegaChart{
this.legend = config.legend || null;
this.barmode = config.barmode || "stack";
this.yaxis_title = config.yaxis_title || "";
this.yaxis2_title = config.yaxis2_title || "";
this.xaxis_title = config.xaxis_title || "";
this.mode = config.mode;
this.marker = config.marker;
if(config.data == null){
this.data_x = config.data_x;
......@@ -75,8 +82,6 @@ class AdegaChart{
transformToAcumulation(){
var number_lines = this.data_y.length;
for(var i in this.data_y){
var acumulation = 0;
......@@ -99,7 +104,7 @@ class AdegaChart{
y: this.data_y[i],
type: this.type[i],
fill: this.fill,
yaxis: this.data_axis_y[i]
yaxis: this.data_axis_y[i],
}
);
......@@ -114,13 +119,22 @@ class AdegaChart{
visible: true,
}
}
if(this.mode && this.mode[i]){
data[i].mode = this.mode[i];
}
if(this.marker != undefined){
data[i].marker = this.marker;
}
}
var layout = {
title: this.title,
showlegend: true,
xaxis:{
title:this.xaxis_title
},
yaxis: {
// title: 'yaxis title',
title: this.yaxis_title,
rangemode: 'tozero'
// overlaying: 'y'
},
......@@ -130,7 +144,8 @@ class AdegaChart{
// tickfont: {color: 'rgb(148, 103, 189)'},
overlaying: 'y1',