diff --git a/.gitignore b/.gitignore index f4da1e7f71a058ffe782accc136ed9a156ec2dba..d347aa28bc0a0b7a489ac077f7b66e6c54324346 100644 --- a/.gitignore +++ b/.gitignore @@ -103,3 +103,8 @@ ENV/ *.sqlite3 *.pyc + +# environment scripts +environment.sh +environment.ps1 +environment.bat diff --git a/README.md b/README.md index db4b5e87acd94e6d9de8b22e133eb32ddcbfb2a5..f8cd16343a15f139b07ace346c28286271244997 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,10 @@ # KSZKĂŠpzĂŠs Honlap -[](https://git.sch.bme.hu/kszk/devteam/kszkepzes/commits/master) -[](https://git.sch.bme.hu/kszk/devteam/kszkepzes/commits/master) +[](https://git.sch.bme.hu/kszk/devteam/kszkepzes/commits/master) +[](https://git.sch.bme.hu/kszk/devteam/kszkepzes/commits/master) ## KĂśvetelmĂŠnyek + 1. python3.5 2. pip @@ -11,11 +12,16 @@ 1. python3 -m venv venv 2. source venv/bin/activate -3. pip install requirements/development.txt -4. python3 src/manage.py runserver +3. mv environment.sh.example environment.sh +4. Ki kell tĂślteni a kĂśrnyezeti vĂĄltozĂłkat. +5. source environment.sh +6. pip install -r requirements/development.txt +7. python3 src/manage.py runserver ## FormĂĄlis KĂśvetelmĂŠnyek 1. flake8-nak feleljen meg 2. 125 karakternĂŠl ne legyen hosszabb sor > TODO: BĂśviteni a kĂśvetelmĂŠnyeket + +> TODO: Windows-os leĂrĂĄs diff --git a/environment.bat.example b/environment.bat.example new file mode 100644 index 0000000000000000000000000000000000000000..7b9d14ba6a1b719ac0da4bfc8eb480ede78a5163 --- /dev/null +++ b/environment.bat.example @@ -0,0 +1,3 @@ +setx SECRET_KEY <CHANGE_TO_SECRET> +setx AUTHSCH_KEY <CHANGE_TO_CLIENT_ID> +setx AUTHSCH_SECRET <CHANGE_TO_AUTHSCH_SECRET> diff --git a/environment.ps1.example b/environment.ps1.example new file mode 100644 index 0000000000000000000000000000000000000000..9b56e254a55ed75defe4a527c22a92f1950d503e --- /dev/null +++ b/environment.ps1.example @@ -0,0 +1,3 @@ +$env:SECRET_KEY=<CHANGE_TO_SECRET> +$env:AUTHSCH_KEY=<CHANGE_TO_CLIENT_ID> +$env:AUTHSCH_SECRET=<CHANGE_TO_AUTHSCH_SECRET> diff --git a/environment.sh.example b/environment.sh.example new file mode 100644 index 0000000000000000000000000000000000000000..14c4e854dbdd5835050a4cc68d37c5bd0b59a28d --- /dev/null +++ b/environment.sh.example @@ -0,0 +1,3 @@ +export SECRET_KEY=<CHANGE_TO_SECRET> +export AUTHSCH_KEY=<CHANGE_TO_CLIENT_ID> +export AUTHSCH_SECRET=<CHANGE_TO_AUTHSCH_SECRET> diff --git a/requirements/base.in b/requirements/base.in index 3e0a788d36d31fdf5152a0c3825153721a8d10fa..442a003143dbc7afde0dac219361683a666615e2 100644 --- a/requirements/base.in +++ b/requirements/base.in @@ -1,2 +1,3 @@ Django==1.11.5 djangorestframework==3.6.4 +django-social-authsch==0.1 diff --git a/requirements/development.txt b/requirements/development.txt index 0d6a74509535f59e1ad637530a161c5b303f9586..68babd8a27fcd1363a821912246752fa0a828d66 100644 --- a/requirements/development.txt +++ b/requirements/development.txt @@ -4,15 +4,28 @@ # # pip-compile --output-file development.txt development.in # +certifi==2017.7.27.1 # via requests +chardet==3.0.4 # via requests click==6.7 # via pip-tools +defusedxml==0.5.0 # via python3-openid, social-auth-core django-extensions==1.9.1 +django-social-authsch==0.1 django==1.11.5 djangorestframework==3.6.4 first==2.0.1 # via pip-tools flake8==3.4.1 +idna==2.6 # via requests mccabe==0.6.1 # via flake8 +oauthlib==2.0.6 # via requests-oauthlib, social-auth-core pip-tools==1.9.0 pycodestyle==2.3.1 # via flake8 pyflakes==1.5.0 # via flake8 +pyjwt==1.5.3 # via social-auth-core +python3-openid==3.1.0 # via social-auth-core pytz==2017.2 # via django -six==1.10.0 # via django-extensions, pip-tools +requests-oauthlib==0.8.0 # via social-auth-core +requests==2.18.4 # via requests-oauthlib, social-auth-core +six==1.10.0 # via django-extensions, pip-tools, social-auth-app-django, social-auth-core +social-auth-app-django==2.0.0 # via django-social-authsch +social-auth-core==1.5.0 # via django-social-authsch, social-auth-app-django +urllib3==1.22 # via requests diff --git a/src/kszkepzes/settings.py b/src/kszkepzes/settings.py index a1b9ce8f4da5a0e19a7056f3661f53505e98a058..2191c8b83ec28ecbcdcb419b0cc126f19ab577bf 100644 --- a/src/kszkepzes/settings.py +++ b/src/kszkepzes/settings.py @@ -20,7 +20,7 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = 'zr$@t#e0f+7j%sg5o_($2=(q*$o*%-bfv(mw@o!enw5w+zt=cb' +SECRET_KEY = os.getenv('SECRET_KEY') # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True @@ -39,7 +39,12 @@ INSTALLED_APPS = [ 'django.contrib.staticfiles', 'django_extensions', 'rest_framework', +<<<<<<< HEAD 'stats' +======= + 'social_django', + 'authsch', +>>>>>>> f31ae04982515a54fa3ce667ce7f5b6aeaf87c00 ] MIDDLEWARE = [ @@ -102,6 +107,18 @@ AUTH_PASSWORD_VALIDATORS = [ }, ] +SOCIAL_AUTH_URL_NAMESPACE = 'social' + +AUTHENTICATION_BACKENDS = [ + 'authsch.authentication.AuthSCHOAuth2', + 'django.contrib.auth.backends.ModelBackend', +] + +SOCIAL_AUTH_AUTHSCH_KEY = os.getenv('AUTHSCH_KEY') +SOCIAL_AUTH_AUTHSCH_SECRET = os.getenv('AUTHSCH_SECRET') +SOCIAL_AUTH_LOGIN_REDIRECT_URL = '/' +LOGIN_URL = "login/authsch/" + # Internationalization # https://docs.djangoproject.com/en/1.11/topics/i18n/ diff --git a/src/kszkepzes/urls.py b/src/kszkepzes/urls.py index 897947f828af68ca203aa5a4c2dacd487e97d4f1..5a143373854dc913626f7e7bfb539826c5cbe465 100644 --- a/src/kszkepzes/urls.py +++ b/src/kszkepzes/urls.py @@ -13,9 +13,10 @@ Including another URLconf 1. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ -from django.conf.urls import url +from django.conf.urls import url, include from django.contrib import admin urlpatterns = [ url(r'^admin/', admin.site.urls), + url('', include('social_django.urls', namespace='social')), ]