Skip to content

Commit

Permalink
Merge pull request #60 from vitorfs/upgrade-django3
Browse files Browse the repository at this point in the history
Release v2.0
  • Loading branch information
vitorfs authored Sep 5, 2021
2 parents ec84153 + 07c98bd commit fc3e734
Show file tree
Hide file tree
Showing 368 changed files with 6,109 additions and 4,475 deletions.
108 changes: 84 additions & 24 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,47 +1,107 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

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

# 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
.tox
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Mr Developer
.mr.developer.cfg
.project
.pydevproject
# Django stuff:
*.log
local_settings.py
db.sqlite3

.DS_Store
# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

reminder.md
# Jupyter Notebook
.ipynb_checkpoints

*.sqlite3
# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

*.bib
maildumps
.idea
# mkdocs documentation
/site

# mypy
.mypy_cache/

.idea/
.DS_Store
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
language: python
python:
- "2.7"
install: "pip install -r requirements.txt"
- "3.9"
install: "pip install -r requirements/tests.txt"
before_script:
- cp .env.example .env
- python manage.py migrate
script:
- python manage.py test --settings=parsifal.test_settings
sudo: false
- python manage.py test --settings=parsifal.settings.tests
sudo: false
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
build:
isort parsifal
black parsifal
flake8 parsifal
./manage.py makemigrations --check --dry-run --settings=parsifal.settings.tests
25 changes: 25 additions & 0 deletions bin/gunicorn_start
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

NAME="parsifal"
DIR=/home/parsifal/parsifal
USER=parsifal
GROUP=parsifal
WORKERS=3
BIND=unix:/home/parsifal/run/gunicorn.sock
DJANGO_SETTINGS_MODULE=parsifal.settings.production
DJANGO_WSGI_MODULE=parsifal.wsgi
LOG_LEVEL=info

source /home/parsifal/venv/bin/activate

export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE
export PYTHONPATH=$DIR:$PYTHONPATH

exec /home/parsifal/venv/bin/gunicorn ${DJANGO_WSGI_MODULE}:application \
--name $NAME \
--workers $WORKERS \
--user=$USER \
--group=$GROUP \
--bind=$BIND \
--log-level=$LOG_LEVEL \
--log-file=-
64 changes: 64 additions & 0 deletions etc/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
upstream app_server {
server unix:/home/parsifal/run/gunicorn.sock fail_timeout=0;
}

server {
server_name www.parsif.al parsif.al;
listen 80;
return 301 https://parsif.al$request_uri;
}

server {
server_name www.parsif.al;
listen 443;
return 301 https://parsif.al$request_uri;
}

server {
server_name parsif.al;
listen 443;

keepalive_timeout 5;
client_max_body_size 64M;

access_log /home/parsifal/logs/nginx-access.log;
error_log /home/parsifal/logs/nginx-error.log;

gzip on;
gzip_types text/plain text/css application/x-javascript image/svg+xml;
gzip_comp_level 1;
gzip_disable msie6;
gzip_http_version 1.0;
gzip_proxied any;
gzip_vary on;

location = /favicon.ico {
alias /home/parsifal/static/img/favicon.ico;
}

location /static/ {
access_log off;
expires 3600;
alias /home/parsifal/static/;
}

location /media/ {
access_log off;
expires 3600;
alias /home/parsifal/media/;
}

location / {
try_files $uri @proxy_to_app;
}

location @proxy_to_app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect off;
proxy_pass http://app_server;
}

}
7 changes: 7 additions & 0 deletions etc/supervisord
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[program:parsifal]
command=/home/parsifal/parsifal/bin/gunicorn_start
user=parsifal
autostart=true
autorestart=true
redirect_stderr=true
stdout_logfile=/home/parsifal/logs/gunicorn.log
20 changes: 16 additions & 4 deletions manage.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys

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

from django.core.management import execute_from_command_line

def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'parsifal.settings.local')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
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?"
) from exc
execute_from_command_line(sys.argv)


if __name__ == '__main__':
main()
48 changes: 0 additions & 48 deletions parsifal/account_settings/forms.py

This file was deleted.

3 changes: 0 additions & 3 deletions parsifal/account_settings/models.py

This file was deleted.

Loading

0 comments on commit fc3e734

Please sign in to comment.