diff --git a/Dockerfile b/Dockerfile index fae3228a..d7c77a5d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,15 @@ -FROM alpine +FROM python:3 ADD entrypoint.sh /entrypoint.sh +ADD requirements.txt requirements.txt RUN \ chmod +x /entrypoint.sh && \ - apk add --update --no-cache python py-pip gettext && \ - pip install --upgrade pip && \ - pip install Django>=1.9 gunicorn && \ - rm -rf /var/cache/apk/* + apt-get update && \ + apt-get install -y --no-install-recommends gettext && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +RUN pip install -r requirements.txt ENTRYPOINT ["/entrypoint.sh"] diff --git a/entrypoint.sh b/entrypoint.sh index 17aac170..a9073ddd 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,9 +1,9 @@ -#!bin/sh +#!bin/bash cd /ipt_connect -if [ "$DEV" == "true" ]; then +if [ "$DEV" = "true" ]; then python manage.py runserver 0.0.0.0:8000 exit 1 fi -gunicorn --workers=${WORKERS} --bind=unix:/ipt_connect/ipt_connect.sock ipt_connect.wsgi \ No newline at end of file +gunicorn --workers=${WORKERS} --bind=unix:/ipt_connect/ipt_connect.sock ipt_connect.wsgi diff --git a/ipt_connect/IPTdev/admin.py b/ipt_connect/IPTdev/admin.py index fe91d200..ae69a02f 100644 --- a/ipt_connect/IPTdev/admin.py +++ b/ipt_connect/IPTdev/admin.py @@ -2,8 +2,8 @@ from django.contrib import admin from solo.admin import SingletonModelAdmin -from model_SupplementaryMaterial import * -from models import * +from .model_SupplementaryMaterial import * +from .models import * # from config.models import SiteConfiguration diff --git a/ipt_connect/IPTdev/cache_per_user.py b/ipt_connect/IPTdev/cache_per_user.py index 40e03c68..257eb755 100644 --- a/ipt_connect/IPTdev/cache_per_user.py +++ b/ipt_connect/IPTdev/cache_per_user.py @@ -33,7 +33,7 @@ def apply_cache(request, *args, **kwargs): # No caching for authorized users: # they have to see the results of their edits immideately! - can_cache = request.user.is_anonymous() and request.method == 'GET' + can_cache = request.user.is_anonymous and request.method == 'GET' # Gera a chave do cache if prefix: @@ -47,7 +47,7 @@ def apply_cache(request, *args, **kwargs): response = None if not response: - print 'Not in cache: %s' % (CACHE_KEY) + print('Not in cache: %s' % (CACHE_KEY)) response = function(request, *args, **kwargs) if can_cache: cache.set(CACHE_KEY, response, ttl) diff --git a/ipt_connect/IPTdev/forms.py b/ipt_connect/IPTdev/forms.py index c8bf34f6..93249b81 100644 --- a/ipt_connect/IPTdev/forms.py +++ b/ipt_connect/IPTdev/forms.py @@ -1,8 +1,8 @@ from django import forms from django.http import JsonResponse -from django.utils.encoding import smart_unicode +from django.utils.encoding import smart_str -from models import Participant +from .models import Participant # class RegisterForm(forms.ModelForm): @@ -31,7 +31,7 @@ def member_for_team(request): if request.GET and "team_id" in request.GET: objs = Participant.objects.filter(team=request.GET["team_id"]) for o in objs: - res.append({"id": o.id, "name": smart_unicode(o)}) + res.append({"id": o.id, "name": smart_str(o)}) # return HttpResponse(json.dumps(res), content_type="application/json") return JsonResponse({"res": res}) diff --git a/ipt_connect/IPTdev/func_mean.py b/ipt_connect/IPTdev/func_mean.py index 87052525..0fd76464 100644 --- a/ipt_connect/IPTdev/func_mean.py +++ b/ipt_connect/IPTdev/func_mean.py @@ -18,7 +18,7 @@ def ipt_mean(vec): # There was an unsuccessful attempt to refactor it. # The code should be refactored and tested. - nhigh = nreject / 2 + nhigh = nreject // 2 nlow = nreject - nhigh if nhigh == 0: diff --git a/ipt_connect/IPTdev/model_SupplementaryMaterial.py b/ipt_connect/IPTdev/model_SupplementaryMaterial.py index 5dd3ef19..8a0f9bbf 100644 --- a/ipt_connect/IPTdev/model_SupplementaryMaterial.py +++ b/ipt_connect/IPTdev/model_SupplementaryMaterial.py @@ -2,11 +2,11 @@ from django.db import models -import models as ipt_connect_models +from . import models as ipt_connect_models class SupplementaryMaterial(models.Model): - team = models.ForeignKey(ipt_connect_models.Team, null=True) - problem = models.ForeignKey(ipt_connect_models.Problem) + team = models.ForeignKey(ipt_connect_models.Team, null=True, on_delete=models.CASCADE) + problem = models.ForeignKey(ipt_connect_models.Problem, on_delete=models.CASCADE) name = models.CharField(max_length=500) link = models.CharField(max_length=5000) diff --git a/ipt_connect/IPTdev/models.py b/ipt_connect/IPTdev/models.py index 54b92814..0fc55c97 100644 --- a/ipt_connect/IPTdev/models.py +++ b/ipt_connect/IPTdev/models.py @@ -1,7 +1,6 @@ # coding: utf8 import os import time -from string import replace from uuid import uuid4 from django.contrib.auth.models import User @@ -16,9 +15,9 @@ from django.utils.encoding import iri_to_uri from solo.models import SingletonModel -import func_mean as means -import parameters as params -from func_bonus import distribute_bonus_points +from . import func_mean as means +from . import parameters as params +from .func_bonus import distribute_bonus_points # Useful static variables selective_fights = [i + 1 for i in range(params.npf)] @@ -120,7 +119,7 @@ class Participant(models.Model): passport_number = models.CharField(blank=True, max_length=50) birthdate = models.DateField(default='1900-01-31', verbose_name='Birthdate') # photo = models.ImageField(upload_to=UploadToPathAndRename(params.instance_name+'/id_photo'),help_text="Please use a clear ID photo. This will be used for badges and transportation cards.", null=True) - team = models.ForeignKey('Team', null=True, verbose_name='Team') + team = models.ForeignKey('Team', null=True, verbose_name='Team', on_delete=models.CASCADE) role = models.CharField( max_length=20, choices=ROLE_CHOICES, @@ -166,7 +165,7 @@ def fullname(self): """ return self.name + ' ' + self.surname - def __unicode__(self): + def __str__(self): """ :return: return the full name of the participant """ @@ -252,7 +251,7 @@ class Problem(models.Model): mean_score_of_opponents = models.FloatField(default=0.0, editable=False) mean_score_of_reviewers = models.FloatField(default=0.0, editable=False) - def __unicode__(self): + def __str__(self): return self.name def status(self, verbose=True, meangradesonly=False): @@ -392,7 +391,7 @@ class Team(models.Model): nrounds_as_opp = models.IntegerField(default=0, editable=False) nrounds_as_rev = models.IntegerField(default=0, editable=False) - def __unicode__(self): + def __str__(self): return self.name @@ -601,7 +600,7 @@ class Room(models.Model): name = models.CharField(max_length=50) link = models.CharField(max_length=2083, blank=True, default='') - def __unicode__(self): + def __str__(self): return self.name @property @@ -625,7 +624,7 @@ def fullname(self): """ return self.name + ' ' + self.surname - def __unicode__(self): + def __str__(self): return self.fullname() email = models.EmailField( @@ -639,7 +638,7 @@ def __unicode__(self): verbose_name='Affiliation to display', help_text='Will be used for export (badges and web).', ) - team = models.ForeignKey('Team', null=True, blank=True) + team = models.ForeignKey('Team', null=True, blank=True, on_delete=models.CASCADE) # TODO: unhardcode PF number! pf1 = models.BooleanField(default=False, verbose_name='PF 1') pf2 = models.BooleanField(default=False, verbose_name='PF 2') @@ -666,29 +665,29 @@ class Round(models.Model): ), default=None, ) - room = models.ForeignKey(Room) + room = models.ForeignKey(Room, on_delete=models.CASCADE) reporter_team = models.ForeignKey( - Team, related_name='reporterteam', blank=True, null=True + Team, related_name='reporterteam', blank=True, null=True, on_delete=models.CASCADE ) opponent_team = models.ForeignKey( - Team, related_name='opponentteam', blank=True, null=True + Team, related_name='opponentteam', blank=True, null=True, on_delete=models.CASCADE ) reviewer_team = models.ForeignKey( - Team, related_name='reviewerteam', blank=True, null=True + Team, related_name='reviewerteam', blank=True, null=True, on_delete=models.CASCADE ) reporter = models.ForeignKey( - Participant, related_name='reporter_name_1', blank=True, null=True + Participant, related_name='reporter_name_1', blank=True, null=True, on_delete=models.CASCADE ) reporter_2 = models.ForeignKey( - Participant, related_name='reporter_name_2', blank=True, null=True + Participant, related_name='reporter_name_2', blank=True, null=True, on_delete=models.CASCADE ) opponent = models.ForeignKey( - Participant, related_name='opponent_name', blank=True, null=True + Participant, related_name='opponent_name', blank=True, null=True, on_delete=models.CASCADE ) reviewer = models.ForeignKey( - Participant, related_name='reviewer_name', blank=True, null=True + Participant, related_name='reviewer_name', blank=True, null=True, on_delete=models.CASCADE ) - problem_presented = models.ForeignKey(Problem, blank=True, null=True) + problem_presented = models.ForeignKey(Problem, blank=True, null=True, on_delete=models.CASCADE) submitted_date = models.DateTimeField(default=timezone.now, blank=True, null=True) score_reporter = models.FloatField(default=0.0, editable=False) @@ -705,7 +704,7 @@ class Round(models.Model): default=0.0, editable=params.manual_bonus_points ) - def __unicode__(self): + def __str__(self): try: fight_name = params.fights['names'][self.pf_number - 1] except: @@ -844,8 +843,8 @@ class Meta: class JuryGrade(models.Model): - round = models.ForeignKey(Round, null=True) - jury = models.ForeignKey(Jury) + round = models.ForeignKey(Round, null=True, on_delete=models.CASCADE) + jury = models.ForeignKey(Jury, on_delete=models.CASCADE) grade_reporter = models.IntegerField(choices=grade_choices, default=None) @@ -853,7 +852,7 @@ class JuryGrade(models.Model): grade_reviewer = models.IntegerField(choices=grade_choices, default=None) - def __unicode__(self): + def __str__(self): return "Grade of %s" % self.jury.name def info(self): @@ -881,36 +880,36 @@ def info(self): class TacticalRejection(models.Model): - round = models.ForeignKey(Round, null=True) - problem = models.ForeignKey(Problem) + round = models.ForeignKey(Round, null=True, on_delete=models.CASCADE) + problem = models.ForeignKey(Problem, on_delete=models.CASCADE) extra_free = models.BooleanField( default=False, verbose_name='Extra free rejection', editable=params.enable_extra_free_tactical_rejections, ) - def __unicode__(self): + def __str__(self): return "Problem rejected : %s" % self.problem.pk class EternalRejection(models.Model): - round = models.ForeignKey(Round, null=True) - problem = models.ForeignKey(Problem) + round = models.ForeignKey(Round, null=True, on_delete=models.CASCADE) + problem = models.ForeignKey(Problem, on_delete=models.CASCADE) extra_free = models.BooleanField( default=False, verbose_name='Extra free rejection', editable=params.enable_extra_free_eternal_rejections, ) - def __unicode__(self): + def __str__(self): return "Problem rejected : %s" % self.problem.pk class AprioriRejection(models.Model): - team = models.ForeignKey(Team, null=True) - problem = models.ForeignKey(Problem) + team = models.ForeignKey(Team, null=True, on_delete=models.CASCADE) + problem = models.ForeignKey(Problem, on_delete=models.CASCADE) - def __unicode__(self): + def __str__(self): # TODO: also print the Team return "Problem rejected : %s" % self.problem.pk @@ -962,7 +961,7 @@ class SiteConfiguration(SingletonModel): image_URL = models.URLField(default="http://i.imgur.com/QH8aoXL.gif") image_repeat_count = models.IntegerField(default=6) - def __unicode__(self): + def __str__(self): return u"Site Configuration" class Meta: diff --git a/ipt_connect/IPTdev/parameters.py b/ipt_connect/IPTdev/parameters.py index ff51b39b..41126c78 100644 --- a/ipt_connect/IPTdev/parameters.py +++ b/ipt_connect/IPTdev/parameters.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from get_script_dir import get_script_dir +from .get_script_dir import get_script_dir # Here we get the name of the folder in which THIS FILE is located. # It is probably NOT the current working directory. diff --git a/ipt_connect/IPTdev/tactics.py b/ipt_connect/IPTdev/tactics.py index 76e1c799..1c633aba 100644 --- a/ipt_connect/IPTdev/tactics.py +++ b/ipt_connect/IPTdev/tactics.py @@ -1,4 +1,4 @@ -from views import * +from .views import * def build_tactics_for_two_teams(reporter_team, opponent_team, current_round=None): @@ -51,14 +51,14 @@ def build_tactics_for_two_teams(reporter_team, opponent_team, current_round=None # Will be filled later # TODO: is it possible to cast a lambda here? ), - 'apriori_rejected_by_reporter': map( + 'apriori_rejected_by_reporter': list(map( lambda rejection: None, list(apri_rej.filter(team=reporter_team)), - ), - 'eternally_rejected_by_reporter': map( + )), + 'eternally_rejected_by_reporter': list(map( lambda rejection: rejection.round, list(eter_rej.filter(round__reporter_team=reporter_team)), - ), + )), 'reported_by_reporter': list(atrounds.filter(reporter_team=reporter_team)), 'opposed_by_opponent': list(atrounds.filter(opponent_team=opponent_team)), 'reported_by_opponent': list(atrounds.filter(reporter_team=opponent_team)), @@ -66,11 +66,11 @@ def build_tactics_for_two_teams(reporter_team, opponent_team, current_round=None # If the opponent tried to challenge for a problem and received a rejection, # it is likely that the opponent will try to challenge for the same problem again. # This knowledge is obviously valuable for the reporter ;-) - 'tried_by_opponent': map( + 'tried_by_opponent': list(map( lambda rejection: rejection.round, list(tact_rej.filter(round__opponent_team=opponent_team)) + list(eter_rej.filter(round__opponent_team=opponent_team)), - ), + )), # The same thing for reviewing 'reviewed_by_opponent': list(atrounds.filter(reviewer_team=opponent_team)), # reporter's oppositions... @@ -78,11 +78,11 @@ def build_tactics_for_two_teams(reporter_team, opponent_team, current_round=None # ... and for reporter's reviews - no idea what for 'reviewed_by_reporter': list(atrounds.filter(reviewer_team=reporter_team)), # Crazyness must go on! - 'tried_by_reporter': map( + 'tried_by_reporter': list(map( lambda rejection: rejection.round, list(tact_rej.filter(round__opponent_team=reporter_team)) + list(eter_rej.filter(round__opponent_team=reporter_team)), - ), + )), } for round in previous_rounds: @@ -197,7 +197,7 @@ class TacticsForm(forms.Form): try: # This fails if no teams are registered (which is essentially for a new tournament) all_teams = Team.objects.all() - team_choices = map(lambda team: (team.pk, team), all_teams) + team_choices = [(team.pk, team) for team in all_teams] reporter_team = forms.ChoiceField(label='Reporter team', choices=team_choices) opponent_team = forms.ChoiceField(label='Opponent team', choices=team_choices) except: diff --git a/ipt_connect/IPTdev/templates/IPTdev/bebacksoon.html b/ipt_connect/IPTdev/templates/IPTdev/bebacksoon.html index 6118cd72..dd868e11 100644 --- a/ipt_connect/IPTdev/templates/IPTdev/bebacksoon.html +++ b/ipt_connect/IPTdev/templates/IPTdev/bebacksoon.html @@ -1,5 +1,5 @@ {% extends params.instance_name|add:'/head.html' %} -{% load staticfiles %} +{% load static %} {% load i18n %} {% load solo_tags %} diff --git a/ipt_connect/IPTdev/templates/IPTdev/head.html b/ipt_connect/IPTdev/templates/IPTdev/head.html index ce303ad8..ef1fce30 100644 --- a/ipt_connect/IPTdev/templates/IPTdev/head.html +++ b/ipt_connect/IPTdev/templates/IPTdev/head.html @@ -1,5 +1,5 @@ {% load i18n %} -{% load staticfiles %} +{% load static %} diff --git a/ipt_connect/IPTdev/urls.py b/ipt_connect/IPTdev/urls.py index 2f75d384..4b3ba342 100644 --- a/ipt_connect/IPTdev/urls.py +++ b/ipt_connect/IPTdev/urls.py @@ -1,52 +1,52 @@ # coding: utf8 -from django.conf.urls import url +from django.urls import re_path -import parameters -from forms import member_for_team -from tactics import * +from . import parameters +from .forms import member_for_team +from .tactics import * app_name = parameters.instance_name urlpatterns = [ - url(r"^$", tournament_overview), - url(r"^tournament$", tournament_overview, name="tournament_overview"), - url(r"^participants$", participants_overview, name="participants_overview"), - url( + re_path(r"^$", tournament_overview), + re_path(r"^tournament$", tournament_overview, name="tournament_overview"), + re_path(r"^participants$", participants_overview, name="participants_overview"), + re_path( r"^participants/(?P[0-9]+)/$", participant_detail, name="participant_detail" ), - url(r"^jurys$", jurys_overview, name="jurys_overview"), - url(r"^member_for_team$", member_for_team), - url(r"^jurys/(?P[0-9]+)/$", jury_detail, name="jury_detail"), - url(r"^problems$", problems_overview, name="problems_overview"), - url(r"^problems/(?P[0-9]+)/$", problem_detail, name="problem_detail"), - url(r"^rounds$", rounds, name="rounds"), - url(r"^rounds/(?P[0-9]+)/$", round_detail, name="round_detail"), - url(r"^round_add_next/(?P[0-9]+)/$", round_add_next, name="round_add_next"), - url(r"^teams$", teams_overview, name="teams"), - url( + re_path(r"^jurys$", jurys_overview, name="jurys_overview"), + re_path(r"^member_for_team$", member_for_team), + re_path(r"^jurys/(?P[0-9]+)/$", jury_detail, name="jury_detail"), + re_path(r"^problems$", problems_overview, name="problems_overview"), + re_path(r"^problems/(?P[0-9]+)/$", problem_detail, name="problem_detail"), + re_path(r"^rounds$", rounds, name="rounds"), + re_path(r"^rounds/(?P[0-9]+)/$", round_detail, name="round_detail"), + re_path(r"^round_add_next/(?P[0-9]+)/$", round_add_next, name="round_add_next"), + re_path(r"^teams$", teams_overview, name="teams"), + re_path( r"^teams/(?P[A-Za-z0-9\w|\W\- ]+)/$", team_detail, name="team_detail" ), - url(r"^physics_fights$", rounds, name="rounds"), - url(r"^physics_fights/$", rounds, name="rounds"), - url( + re_path(r"^physics_fights$", rounds, name="rounds"), + re_path(r"^physics_fights/$", rounds, name="rounds"), + re_path( r"^physics_fights/(?P[0-9]+)/$", physics_fight_detail, name="physics_fight_detail", ), - url(r"^ranking$", ranking, name="ranking"), - url(r"^build_tactics$", build_tactics), - url(r"^poolranking$", poolranking, name="poolranking"), - url(r"^export_csv_ranking_timeline$", export_csv_ranking_timeline), - url(r"^participants_export$", participants_export), - url(r"^participants_export_web$", participants_export_web), - url(r"^participants_all$", participants_all), - url(r"^jury_export$", jury_export), - url(r"^jury_export_csv$", jury_export_csv), - url(r"^jury_export_web$", jury_export_web), - url(r"^trombinoscope$", participants_trombinoscope), - url(r"^soon", soon), - url(r"^update_all", update_all, name="update_all"), - url(r"^verify_all", verify_all, name="verify_all"), - url(r"^upload_csv", upload_csv, name="upload_csv"), - url(r"^upload_problems", upload_problems, name="upload_problems"), + re_path(r"^ranking$", ranking, name="ranking"), + re_path(r"^build_tactics$", build_tactics), + re_path(r"^poolranking$", poolranking, name="poolranking"), + re_path(r"^export_csv_ranking_timeline$", export_csv_ranking_timeline), + re_path(r"^participants_export$", participants_export), + re_path(r"^participants_export_web$", participants_export_web), + re_path(r"^participants_all$", participants_all), + re_path(r"^jury_export$", jury_export), + re_path(r"^jury_export_csv$", jury_export_csv), + re_path(r"^jury_export_web$", jury_export_web), + re_path(r"^trombinoscope$", participants_trombinoscope), + re_path(r"^soon", soon), + re_path(r"^update_all", update_all, name="update_all"), + re_path(r"^verify_all", verify_all, name="verify_all"), + re_path(r"^upload_csv", upload_csv, name="upload_csv"), + re_path(r"^upload_problems", upload_problems, name="upload_problems"), ] diff --git a/ipt_connect/IPTdev/utils/link_parser.py b/ipt_connect/IPTdev/utils/link_parser.py index 2e4ddc1e..5a1ae40e 100644 --- a/ipt_connect/IPTdev/utils/link_parser.py +++ b/ipt_connect/IPTdev/utils/link_parser.py @@ -51,7 +51,7 @@ links_all.append(link) unique_url = list(set(links_all)) # delete duplicate log lines -print 'Link checking ...' +print('Link checking ...') for li in unique_url: status_code = requests.get(li).status_code @@ -64,10 +64,10 @@ if status_code != 404: links_error.append((link, status_code)) -print 'Finished' -print 'Static files' +print('Finished') +print('Static files') for i in set(links_static): - print i -print 'Error links' + print(i) +print('Error links') for i in links_error: - print i + print(i) diff --git a/ipt_connect/IPTdev/views.py b/ipt_connect/IPTdev/views.py index 6370fc6f..328e5aed 100644 --- a/ipt_connect/IPTdev/views.py +++ b/ipt_connect/IPTdev/views.py @@ -7,10 +7,10 @@ from django.shortcuts import render from django.utils.translation import get_language -from cache_per_user import cache_per_user as cache_page -from forms import UploadForm -from model_SupplementaryMaterial import SupplementaryMaterial -from models import * +from .cache_per_user import cache_per_user as cache_page +from .forms import UploadForm +from .model_SupplementaryMaterial import SupplementaryMaterial +from .models import * def home(request): @@ -840,7 +840,7 @@ def round_detail(request, pk): raise Http404() # TODO: rewrite the following in pythonish way!!! - from tactics import make_old_fashioned_list_from_tactics_data + from .tactics import make_old_fashioned_list_from_tactics_data jurygrades = JuryGrade.objects.filter(round=round).order_by('jury__name') meangrades = [] diff --git a/ipt_connect/db.sqlite3 b/ipt_connect/db.sqlite3 index 09cfcb7c..4112ede1 100644 Binary files a/ipt_connect/db.sqlite3 and b/ipt_connect/db.sqlite3 differ diff --git a/ipt_connect/ipt_connect/URLLocaleMiddleWare.py b/ipt_connect/ipt_connect/URLLocaleMiddleWare.py index 8babce0b..ffe8729e 100644 --- a/ipt_connect/ipt_connect/URLLocaleMiddleWare.py +++ b/ipt_connect/ipt_connect/URLLocaleMiddleWare.py @@ -1,9 +1,10 @@ from django.utils import translation +from django.utils.deprecation import MiddlewareMixin url_locale = (('/FPT2017', 'fr'),) -class URLLocaleMiddleware: +class URLLocaleMiddleware(MiddlewareMixin): def process_request(self, request): for (url, loc) in url_locale: if request.path.startswith(url): diff --git a/ipt_connect/ipt_connect/settings.py b/ipt_connect/ipt_connect/settings.py index dceddaac..c6fd10f1 100644 --- a/ipt_connect/ipt_connect/settings.py +++ b/ipt_connect/ipt_connect/settings.py @@ -51,19 +51,18 @@ 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.humanize', - 'loginas', ) + INSTALLED_TOURNAMENTS MIGRATION_MODULES = dict( [(app, app + '.migrations.' + app) for app in INSTALLED_TOURNAMENTS] ) -MIDDLEWARE_CLASSES = ( +MIDDLEWARE = ( '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.sessions.middleware.SessionMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', # 'django.middleware.security.SecurityMiddleware', @@ -140,3 +139,5 @@ SOLO_CACHE = 'default' SOLO_CACHE_TIMEOUT = 5 * 60 + +DEFAULT_AUTO_FIELD='django.db.models.AutoField' \ No newline at end of file diff --git a/ipt_connect/ipt_connect/urls.py b/ipt_connect/ipt_connect/urls.py index b2aa42cd..ba7332c3 100644 --- a/ipt_connect/ipt_connect/urls.py +++ b/ipt_connect/ipt_connect/urls.py @@ -1,7 +1,7 @@ import importlib from django.conf import settings -from django.conf.urls import include, url +from django.urls import include, re_path from django.contrib import admin tournament_overview = importlib.import_module( @@ -12,16 +12,15 @@ # Examples: # url(r'^$', 'ipt_connect.views.home', name='home'), # url(r'^blog/', include('blog.urls')), - url(r'^grappelli/', include('grappelli.urls')), # grappelli URLS + re_path(r'^grappelli/', include('grappelli.urls')), # grappelli URLS # url(r'^$', home, name='home'), #TemplateView.as_view(template_name='index.html')),#'ipt_connect.views.home'), - url(r'^$', tournament_overview), - url(r'^admin/', include(admin.site.urls)), - url(r'^admin/', include('loginas.urls')), + re_path(r'^$', tournament_overview), + re_path(r'^admin/', admin.site.urls), ] for tournament in settings.INSTALLED_TOURNAMENTS: urlpatterns.append( - url( + re_path( r'^' + tournament + '/', include(tournament + '.urls', namespace=tournament) ), ) diff --git a/ipt_connect/manage.py b/ipt_connect/manage.py index 0f176bb5..901c92b6 100755 --- a/ipt_connect/manage.py +++ b/ipt_connect/manage.py @@ -23,7 +23,7 @@ def is_po_updated(path): from django.core.management import execute_from_command_line if sys.argv[1] == "runserver": - if is_po_updated("locale") or is_po_updated("loginas/locale"): + if is_po_updated("locale"): execute_from_command_line(["manage.py", "compilemessages"]) execute_from_command_line(sys.argv) diff --git a/ipt_connect/templates/index.html b/ipt_connect/templates/index.html index c5388b19..6f05b3bf 100644 --- a/ipt_connect/templates/index.html +++ b/ipt_connect/templates/index.html @@ -1,4 +1,4 @@ -{% load staticfiles %} +{% load static %} diff --git a/requirements.txt b/requirements.txt index cd92306f..cfa880f3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,10 +1,9 @@ Django>=1.9 Pillow>=4.0 -django-grappelli==2.8.1 -django-loginas==0.3.1 -django-solo-grappelli>=1.1.2 +django-grappelli +django-solo gitpython gunicorn lxml requests -unicodecsv \ No newline at end of file +unicodecsv