Commit f66bb2b6 authored by Florent Chehab's avatar Florent Chehab

removed deploy CI #42

Repo structure complete redesign
Fixes #38
parent 818af843
...@@ -5,7 +5,6 @@ db.sqlite3 ...@@ -5,7 +5,6 @@ db.sqlite3
/static /static
.DS_Store .DS_Store
/media/* /media/*
node_modules
.coverage .coverage
htmlcov htmlcov
.vscode .vscode
......
...@@ -54,22 +54,3 @@ pages: ...@@ -54,22 +54,3 @@ pages:
- master - master
tags: tags:
- docker - docker
deliver_for_production:
type: deploy
before_script:
## look here for info : https://docs.gitlab.com/ee/ci/ssh_keys/#ssh-keys-when-using-the-docker-executor
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
script:
- ssh $SERVER_USER_USERNAME@$SERVER 'bash -s' < deploy.sh
only:
- production
tags:
- docker
...@@ -3,7 +3,7 @@ omit = ...@@ -3,7 +3,7 @@ omit =
*migrations* *migrations*
*/tests/* */tests/*
manage.py manage.py
general/wsgi.py base_app/wsgi.py
*/urls.py */urls.py
*/admin.py */admin.py
......
...@@ -4,7 +4,4 @@ ignore = E501 ...@@ -4,7 +4,4 @@ ignore = E501
exclude = exclude =
env/* env/*
node_modules/* node_modules/*
backend/urls.py base_app/settings/development.py
backend/admin.py
backend/permissions/__list_user_post_permission.py
general/settings/development.py
/static
\ No newline at end of file
default_app_config = 'backend.apps.BackendConfig'
from django.apps import AppConfig
class BackendConfig(AppConfig):
name = 'backend'
def ready(self):
import backend.signals.__create_user_modules_post_create # noqa: F401
import backend.signals.__squash_revision_by_user # noqa: F401
import backend.signals.__create_univ_modules_post_save # noqa: F401
default_app_config = 'backend_app.apps.BackendAppConfig'
...@@ -14,7 +14,7 @@ for model in api_config: ...@@ -14,7 +14,7 @@ for model in api_config:
if "model" in model and model['model']: if "model" in model and model['model']:
model = DotMap(model) model = DotMap(model)
if (not model.requires_testing) and (not model.ignore_in_admin): if (not model.requires_testing) and (not model.ignore_in_admin):
module = importlib.import_module("backend.models.{}".format (model.import_location)) module = importlib.import_module("backend_app.models.{}".format (model.import_location))
if model.versionned: if model.versionned:
VERSIONNED_MODELS.append(getattr(module, model.model)) VERSIONNED_MODELS.append(getattr(module, model.model))
else: else:
......
from django.apps import AppConfig
class BackendAppConfig(AppConfig):
name = 'backend_app'
def ready(self):
import backend_app.signals.__create_user_modules_post_create # noqa: F401
import backend_app.signals.__squash_revision_by_user # noqa: F401
import backend_app.signals.__create_univ_modules_post_save # noqa: F401
from backend.fields import JSONField from backend_app.fields import JSONField
from rest_framework import serializers from rest_framework import serializers
field_mapping = serializers.ModelSerializer.serializer_field_mapping field_mapping = serializers.ModelSerializer.serializer_field_mapping
......
from backend.models.country import Country from backend_app.models.country import Country
import os import os
import pandas as pd import pandas as pd
from .loadGeneric import LoadGeneric from .loadGeneric import LoadGeneric
......
from backend.models.currency import Currency from backend_app.models.currency import Currency
import os import os
import csv import csv
from .loadGeneric import LoadGeneric from .loadGeneric import LoadGeneric
......
from backend.models.tag import Tag from backend_app.models.tag import Tag
import os import os
import json import json
......
from backend.models.country import Country from backend_app.models.country import Country
from backend.models.city import City from backend_app.models.city import City
from backend.models.university import University from backend_app.models.university import University
from backend.models.campus import Campus from backend_app.models.campus import Campus
import os import os
import pandas as pd import pandas as pd
......
from .loadGeneric import LoadGeneric from .loadGeneric import LoadGeneric
from backend.models.university import University from backend_app.models.university import University
from backend.models.university import UniversityDri from backend_app.models.university import UniversityDri
from backend.models.university import UniversityInfo from backend_app.models.university import UniversityInfo
from backend.models.university import UniversitySemestersDates from backend_app.models.university import UniversitySemestersDates
from backend.models.country import CountryScholarship from backend_app.models.country import CountryScholarship
from backend.models.country import Country from backend_app.models.country import Country
from backend.models.university import UniversityTaggedItem from backend_app.models.university import UniversityTaggedItem
from backend.models.currency import Currency from backend_app.models.currency import Currency
from backend.models.tag import Tag from backend_app.models.tag import Tag
from datetime import datetime from datetime import datetime
......
# Generated by Django 2.0.3 on 2018-09-16 13:55 # Generated by Django 2.0.3 on 2018-09-16 13:55
import backend.models.university.university import backend_app.models.university.university
from django.db import migrations, models from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('backend', '0001_initial'), ('backend_app', '0001_initial'),
] ]
operations = [ operations = [
...@@ -144,7 +144,7 @@ class Migration(migrations.Migration): ...@@ -144,7 +144,7 @@ class Migration(migrations.Migration):
migrations.AlterField( migrations.AlterField(
model_name='university', model_name='university',
name='logo', name='logo',
field=models.URLField(blank=True, default='', validators=[backend.models.university.university.validate_extension_django]), field=models.URLField(blank=True, default='', validators=[backend_app.models.university.university.validate_extension_django]),
), ),
migrations.AlterField( migrations.AlterField(
model_name='university', model_name='university',
......
...@@ -6,7 +6,7 @@ from django.db import migrations, models ...@@ -6,7 +6,7 @@ from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('backend', '0002_auto_20180916_1555'), ('backend_app', '0002_auto_20180916_1555'),
] ]
operations = [ operations = [
......
from django.db import models from django.db import models
from backend.models.abstract.my_model import MyModelVersionned, MyModelVersionnedSerializer, MyModelVersionnedViewSet from backend_app.models.abstract.my_model import MyModelVersionned, MyModelVersionnedSerializer, MyModelVersionnedViewSet
from backend.fields import JSONField from backend_app.fields import JSONField
from backend.validators.tag import validate_content_against_config from backend_app.validators.tag import validate_content_against_config
from backend.validators.tag.tags_config import USEFULL_LINKS_CONFIG from backend_app.validators.tag.tags_config import USEFULL_LINKS_CONFIG
IMPORTANCE_LEVEL = ( IMPORTANCE_LEVEL = (
('-', 'normal'), ('-', 'normal'),
......
...@@ -2,7 +2,7 @@ from .myModel import MyModel ...@@ -2,7 +2,7 @@ from .myModel import MyModel
from .myModelSerializer import MyModelSerializer from .myModelSerializer import MyModelSerializer
from .myModelViewSet import MyModelViewSet from .myModelViewSet import MyModelViewSet
from django.db import models from django.db import models
from backend.utils import get_model_config, get_viewset_permissions from backend_app.utils import get_model_config, get_viewset_permissions
class ForTestingModeration(MyModel): class ForTestingModeration(MyModel):
......
from .myModelVersionned import MyModelVersionned, MyModelVersionnedSerializer, MyModelVersionnedViewSet from .myModelVersionned import MyModelVersionned, MyModelVersionnedSerializer, MyModelVersionnedViewSet
from django.db import models from django.db import models
import reversion import reversion
from backend.utils import get_model_config, get_viewset_permissions from backend_app.utils import get_model_config, get_viewset_permissions
@reversion.register() @reversion.register()
......
...@@ -5,9 +5,9 @@ from .pendingModeration import PendingModeration ...@@ -5,9 +5,9 @@ from .pendingModeration import PendingModeration
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from .myModel import MyModel from .myModel import MyModel
from .pendingModeration import PendingModerationSerializer from .pendingModeration import PendingModerationSerializer
from backend.utils import get_user_level from backend_app.utils import get_user_level
from backend.permissions import is_moderation_required from backend_app.permissions import is_moderation_required
from backend.custom import MySerializerWithJSON from backend_app.custom import MySerializerWithJSON
CLEANED_MY_MODEL_DATA = { CLEANED_MY_MODEL_DATA = {
'moderated_by': None, 'moderated_by': None,
......
from backend.models.abstract.my_model import MyModel, MyModelSerializer, MyModelViewSet from backend_app.models.abstract.my_model import MyModel, MyModelSerializer, MyModelViewSet
from backend.signals.__squash_revision_by_user import new_revision_saved from backend_app.signals.__squash_revision_by_user import new_revision_saved
from rest_framework import serializers, mixins, viewsets from rest_framework import serializers, mixins, viewsets
import reversion import reversion
from reversion.models import Version from reversion.models import Version
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.core.serializers.base import DeserializationError from django.core.serializers.base import DeserializationError
from django.core import serializers as djangoSerializers from django.core import serializers as djangoSerializers
from backend.utils import get_viewset_permissions from backend_app.utils import get_viewset_permissions
from backend.custom import MySerializerWithJSON from backend_app.custom import MySerializerWithJSON
class MyModelVersionned(MyModel): class MyModelVersionned(MyModel):
......
from .myModelSerializer import MyModelSerializer from .myModelSerializer import MyModelSerializer
from backend.permissions import DEFAULT_VIEWSET_PERMISSIONS from backend_app.permissions import DEFAULT_VIEWSET_PERMISSIONS
from backend.custom import DictModeViewSet from backend_app.custom import DictModeViewSet
class MyModelViewSet(DictModeViewSet): class MyModelViewSet(DictModeViewSet):
......
...@@ -2,10 +2,10 @@ from django.db import models ...@@ -2,10 +2,10 @@ from django.db import models
from rest_framework import serializers, viewsets from rest_framework import serializers, viewsets
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.fields import GenericForeignKey from django.contrib.contenttypes.fields import GenericForeignKey
from backend.fields import JSONField from backend_app.fields import JSONField
from django.contrib.auth.models import User from django.contrib.auth.models import User
from backend.utils import get_viewset_permissions, get_model_config from backend_app.utils import get_viewset_permissions, get_model_config
from backend.custom import MySerializerWithJSON from backend_app.custom import MySerializerWithJSON
class PendingModeration(models.Model): class PendingModeration(models.Model):
......
from django.db import models from django.db import models
from backend.models.abstract.basic_module import BasicModule, BasicModuleSerializer, BasicModuleViewSet from backend_app.models.abstract.basic_module import BasicModule, BasicModuleSerializer, BasicModuleViewSet
from backend.models.currency import Currency from backend_app.models.currency import Currency
from rest_framework import serializers from rest_framework import serializers
from django.core.validators import MinValueValidator from django.core.validators import MinValueValidator
......
from django.db import models from django.db import models
from backend.models.abstract.basic_module import BasicModule, BasicModuleSerializer, BasicModuleViewSet from backend_app.models.abstract.basic_module import BasicModule, BasicModuleSerializer, BasicModuleViewSet
from backend.models.tag import Tag from backend_app.models.tag import Tag
from backend.validators.tag import tagged_item_validation from backend_app.validators.tag import tagged_item_validation
from backend.fields import JSONField from backend_app.fields import JSONField
class TaggedItem(BasicModule): class TaggedItem(BasicModule):
......
from django.db import models from django.db import models
from backend.models.abstract.basic_module import BasicModule, BasicModuleSerializer, BasicModuleViewSet from backend_app.models.abstract.basic_module import BasicModule, BasicModuleSerializer, BasicModuleViewSet
from backend.models.city import City from backend_app.models.city import City
from backend.models.university import University from backend_app.models.university import University
from django.core.validators import MinValueValidator, MaxValueValidator from django.core.validators import MinValueValidator, MaxValueValidator
from backend.utils import get_model_config, get_viewset_permissions from backend_app.utils import get_model_config, get_viewset_permissions
class Campus(BasicModule): class Campus(BasicModule):
......
from django.db import models from django.db import models
from backend.models.campus import Campus from backend_app.models.campus import Campus
from backend.models.abstract.taggedItem import TaggedItem, TaggedItemSerializer, TaggedItemViewSet from backend_app.models.abstract.taggedItem import TaggedItem, TaggedItemSerializer, TaggedItemViewSet
from backend.utils import get_model_config, get_viewset_permissions from backend_app.utils import get_model_config, get_viewset_permissions
class CampusTaggedItem(TaggedItem): class CampusTaggedItem(TaggedItem):
......
from django.db import models from django.db import models
from backend.models.country import Country from backend_app.models.country import Country
from backend.models.abstract.my_model import MyModel, MyModelSerializer, MyModelVersionnedViewSet from backend_app.models.abstract.my_model import MyModel, MyModelSerializer, MyModelVersionnedViewSet
from backend.utils import get_model_config, get_viewset_permissions from backend_app.utils import get_model_config, get_viewset_permissions
class City(MyModel): class City(MyModel):
......
from django.db import models from django.db import models
from backend.models.abstract.taggedItem import TaggedItem, TaggedItemSerializer, TaggedItemViewSet from backend_app.models.abstract.taggedItem import TaggedItem, TaggedItemSerializer, TaggedItemViewSet
from backend.models.city import City from backend_app.models.city import City
from backend.utils import get_model_config, get_viewset_permissions from backend_app.utils import get_model_config, get_viewset_permissions
class CityTaggedItem(TaggedItem): class CityTaggedItem(TaggedItem):
......
from django.db import models from django.db import models
from backend.models.abstract.my_model import MyModel, MyModelSerializer, MyModelVersionnedViewSet from backend_app.models.abstract.my_model import MyModel, MyModelSerializer, MyModelVersionnedViewSet
from backend.utils import get_model_config, get_viewset_permissions from backend_app.utils import get_model_config, get_viewset_permissions
# Data model based on : https://unstats.un.org/unsd/methodology/m49/overview/ # Data model based on : https://unstats.un.org/unsd/methodology/m49/overview/
......
from django.db import models from django.db import models
from backend.models.country import Country from backend_app.models.country import Country
from backend.models.abstract.basic_module import BasicModule, BasicModuleSerializer, BasicModuleViewSet from backend_app.models.abstract.basic_module import BasicModule, BasicModuleSerializer, BasicModuleViewSet
from backend.utils import get_model_config, get_viewset_permissions from backend_app.utils import get_model_config, get_viewset_permissions
class CountryDri(BasicModule): class CountryDri(BasicModule):
......
from django.db import models from django.db import models
from backend.models.country import Country from backend_app.models.country import Country
from backend.models.abstract.scholarship import Scholarship, ScholarshipSerializer, ScholarshipViewSet from backend_app.models.abstract.scholarship import Scholarship, ScholarshipSerializer, ScholarshipViewSet
from backend.utils import get_model_config, get_viewset_permissions from backend_app.utils import get_model_config, get_viewset_permissions
class CountryScholarship(Scholarship): class CountryScholarship(Scholarship):
......
from django.db import models from django.db import models
from backend.models.abstract.taggedItem import TaggedItem, TaggedItemSerializer, TaggedItemViewSet from backend_app.models.abstract.taggedItem import TaggedItem, TaggedItemSerializer, TaggedItemViewSet
from backend.models.country import Country from backend_app.models.country import Country
from backend.utils import get_model_config, get_viewset_permissions from backend_app.utils import get_model_config, get_viewset_permissions
class CountryTaggedItem(TaggedItem): class CountryTaggedItem(TaggedItem):
......
from django.db import models from django.db import models
from django.core.validators import MinValueValidator from django.core.validators import MinValueValidator
from backend.models.abstract.my_model import MyModel, MyModelSerializer, MyModelViewSet from backend_app.models.abstract.my_model import MyModel, MyModelSerializer, MyModelViewSet
from backend.utils import get_model_config, get_viewset_permissions from backend_app.utils import get_model_config, get_viewset_permissions