Commit 1d0c8743 authored by okhin's avatar okhin 🚴

Merge branch '11-api-rest-push-pull-contenu' into 'rp2'

Resolve "API REST : push/pull contenu"

See merge request !16
parents 1eb4dc18 55650dc0
Pipeline #2509 passed with stages
in 3 minutes and 3 seconds
......@@ -22,7 +22,7 @@ unit tests:
- pip install -r requirements-tests.txt
- echo "DEBUG = True" > ./project/settings/env.py
- echo "SECRET_KEY = '$(pwgen 20 1)'" >> ./project/settings/env.py
- ./manage.py migrate
- ./manage.py migrate --run-syncdb
- pytest apps/ --cov=apps/
tags: [preprod]
......@@ -57,7 +57,7 @@ deploy preprod:
- echo "DEBUG = True" > ${BASE_PATH}/project/settings/env.py
- echo "SECRET_KEY = '$(pwgen 20 1)'" >> ${BASE_PATH}/project/settings/env.py
- echo "SITE_ID = 2" >> ${BASE_PATH}/project/settings/env.py
- ${BASE_PATH}/manage.py migrate
- ${BASE_PATH}/manage.py migrate --run-syncdb
- touch ${BASE_PATH}/ready
only:
- rp2
......
default_app_config = 'userprofile.apps.UserprofileConfig'
......@@ -3,3 +3,6 @@ from django.apps import AppConfig
class UserprofileConfig(AppConfig):
name = 'userprofile'
def ready(self):
import userprofile.signals
from django.db.models.signals import post_save
from django.dispatch import receiver
from rest_framework.authtoken.models import Token
from django.conf import settings
@receiver(post_save, sender=settings.AUTH_USER_MODEL)
def create_user_token(sender, instance=None, created=False, *args, **wkargs):
if created:
Token.objects.create(user=instance)
......@@ -10,5 +10,6 @@ from .env import DEBUG
if DEBUG:
ALLOWED_HOSTS = ['*']
INTERNAL_IPS = ('127.0.0.1',)
elif 'DJANGO_ALLOWED_HOSTS' in os.environ:
ALLOWED_HOSTS = [os.environ['DJANGO_ALLOWED_HOSTS']]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment