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
/static
.DS_Store
/media/*
node_modules
.coverage
htmlcov
.vscode
......
......@@ -54,22 +54,3 @@ pages:
- master
tags:
- 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 =
*migrations*
*/tests/*
manage.py
general/wsgi.py
base_app/wsgi.py
*/urls.py
*/admin.py
......
......@@ -4,7 +4,4 @@ ignore = E501
exclude =
env/*
node_modules/*
backend/urls.py
backend/admin.py
backend/permissions/__list_user_post_permission.py
general/settings/development.py
base_app/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:
if "model" in model and model['model']:
model = DotMap(model)
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:
VERSIONNED_MODELS.append(getattr(module, model.model))
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
field_mapping = serializers.ModelSerializer.serializer_field_mapping
......
from backend.models.country import Country
from backend_app.models.country import Country
import os
import pandas as pd
from .loadGeneric import LoadGeneric
......
from backend.models.currency import Currency
from backend_app.models.currency import Currency
import os
import csv
from .loadGeneric import LoadGeneric
......
from backend.models.tag import Tag
from backend_app.models.tag import Tag
import os
import json
......
from backend.models.country import Country
from backend.models.city import City
from backend.models.university import University
from backend.models.campus import Campus
from backend_app.models.country import Country
from backend_app.models.city import City
from backend_app.models.university import University
from backend_app.models.campus import Campus
import os
import pandas as pd
......
from .loadGeneric import LoadGeneric
from backend.models.university import University
from backend.models.university import UniversityDri
from backend.models.university import UniversityInfo
from backend.models.university import UniversitySemestersDates
from backend.models.country import CountryScholarship
from backend.models.country import Country
from backend.models.university import UniversityTaggedItem
from backend_app.models.university import University
from backend_app.models.university import UniversityDri
from backend_app.models.university import UniversityInfo
from backend_app.models.university import UniversitySemestersDates
from backend_app.models.country import CountryScholarship
from backend_app.models.country import Country
from backend_app.models.university import UniversityTaggedItem
from backend.models.currency import Currency
from backend.models.tag import Tag
from backend_app.models.currency import Currency
from backend_app.models.tag import Tag
from datetime import datetime
......
# 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
class Migration(migrations.Migration):
dependencies = [
('backend', '0001_initial'),
('backend_app', '0001_initial'),
]
operations = [
......@@ -144,7 +144,7 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='university',
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(
model_name='university',
......
......@@ -6,7 +6,7 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('backend', '0002_auto_20180916_1555'),
('backend_app', '0002_auto_20180916_1555'),
]
operations = [
......
from django.db import models
from backend.models.abstract.my_model import MyModelVersionned, MyModelVersionnedSerializer, MyModelVersionnedViewSet
from backend.fields import JSONField
from backend.validators.tag import validate_content_against_config
from backend.validators.tag.tags_config import USEFULL_LINKS_CONFIG
from backend_app.models.abstract.my_model import MyModelVersionned, MyModelVersionnedSerializer, MyModelVersionnedViewSet
from backend_app.fields import JSONField
from backend_app.validators.tag import validate_content_against_config
from backend_app.validators.tag.tags_config import USEFULL_LINKS_CONFIG
IMPORTANCE_LEVEL = (
('-', 'normal'),
......
......@@ -2,7 +2,7 @@ from .myModel import MyModel
from .myModelSerializer import MyModelSerializer
from .myModelViewSet import MyModelViewSet
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):
......
from .myModelVersionned import MyModelVersionned, MyModelVersionnedSerializer, MyModelVersionnedViewSet
from django.db import models
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()
......
......@@ -5,9 +5,9 @@ from .pendingModeration import PendingModeration
from django.contrib.contenttypes.models import ContentType
from .myModel import MyModel
from .pendingModeration import PendingModerationSerializer
from backend.utils import get_user_level
from backend.permissions import is_moderation_required
from backend.custom import MySerializerWithJSON
from backend_app.utils import get_user_level
from backend_app.permissions import is_moderation_required
from backend_app.custom import MySerializerWithJSON
CLEANED_MY_MODEL_DATA = {
'moderated_by': None,
......
from backend.models.abstract.my_model import MyModel, MyModelSerializer, MyModelViewSet
from backend.signals.__squash_revision_by_user import new_revision_saved
from backend_app.models.abstract.my_model import MyModel, MyModelSerializer, MyModelViewSet
from backend_app.signals.__squash_revision_by_user import new_revision_saved
from rest_framework import serializers, mixins, viewsets
import reversion
from reversion.models import Version
from django.contrib.contenttypes.models import ContentType
from django.core.serializers.base import DeserializationError
from django.core import serializers as djangoSerializers
from backend.utils import get_viewset_permissions
from backend.custom import MySerializerWithJSON
from backend_app.utils import get_viewset_permissions
from backend_app.custom import MySerializerWithJSON
class MyModelVersionned(MyModel):
......
from .myModelSerializer import MyModelSerializer
from backend.permissions import DEFAULT_VIEWSET_PERMISSIONS
from backend.custom import DictModeViewSet
from backend_app.permissions import DEFAULT_VIEWSET_PERMISSIONS
from backend_app.custom import DictModeViewSet
class MyModelViewSet(DictModeViewSet):
......
......@@ -2,10 +2,10 @@ from django.db import models
from rest_framework import serializers, viewsets
from django.contrib.contenttypes.models import ContentType
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 backend.utils import get_viewset_permissions, get_model_config
from backend.custom import MySerializerWithJSON
from backend_app.utils import get_viewset_permissions, get_model_config
from backend_app.custom import MySerializerWithJSON
class PendingModeration(models.Model):
......
from django.db import models
from backend.models.abstract.basic_module import BasicModule, BasicModuleSerializer, BasicModuleViewSet
from backend.models.currency import Currency
from backend_app.models.abstract.basic_module import BasicModule, BasicModuleSerializer, BasicModuleViewSet
from backend_app.models.currency import Currency
from rest_framework import serializers
from django.core.validators import MinValueValidator
......
from django.db import models
from backend.models.abstract.basic_module import BasicModule, BasicModuleSerializer, BasicModuleViewSet
from backend.models.tag import Tag
from backend.validators.tag import tagged_item_validation
from backend.fields import JSONField
from backend_app.models.abstract.basic_module import BasicModule, BasicModuleSerializer, BasicModuleViewSet
from backend_app.models.tag import Tag
from backend_app.validators.tag import tagged_item_validation
from backend_app.fields import JSONField
class TaggedItem(BasicModule):
......
from django.db import models
from backend.models.abstract.basic_module import BasicModule, BasicModuleSerializer, BasicModuleViewSet
from backend.models.city import City
from backend.models.university import University
from backend_app.models.abstract.basic_module import BasicModule, BasicModuleSerializer, BasicModuleViewSet
from backend_app.models.city import City
from backend_app.models.university import University
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):
......
from django.db import models
from backend.models.campus import Campus
from backend.models.abstract.taggedItem import TaggedItem, TaggedItemSerializer, TaggedItemViewSet
from backend.utils import get_model_config, get_viewset_permissions
from backend_app.models.campus import Campus
from backend_app.models.abstract.taggedItem import TaggedItem, TaggedItemSerializer, TaggedItemViewSet
from backend_app.utils import get_model_config, get_viewset_permissions
class CampusTaggedItem(TaggedItem):
......
from django.db import models
from backend.models.country import Country
from backend.models.abstract.my_model import MyModel, MyModelSerializer, MyModelVersionnedViewSet
from backend.utils import get_model_config, get_viewset_permissions
from backend_app.models.country import Country
from backend_app.models.abstract.my_model import MyModel, MyModelSerializer, MyModelVersionnedViewSet
from backend_app.utils import get_model_config, get_viewset_permissions
class City(MyModel):
......
from django.db import models
from backend.models.abstract.taggedItem import TaggedItem, TaggedItemSerializer, TaggedItemViewSet
from backend.models.city import City
from backend.utils import get_model_config, get_viewset_permissions
from backend_app.models.abstract.taggedItem import TaggedItem, TaggedItemSerializer, TaggedItemViewSet
from backend_app.models.city import City
from backend_app.utils import get_model_config, get_viewset_permissions
class CityTaggedItem(TaggedItem):
......
from django.db import models
from backend.models.abstract.my_model import MyModel, MyModelSerializer, MyModelVersionnedViewSet
from backend.utils import get_model_config, get_viewset_permissions
from backend_app.models.abstract.my_model import MyModel, MyModelSerializer, MyModelVersionnedViewSet
from backend_app.utils import get_model_config, get_viewset_permissions
# Data model based on : https://unstats.un.org/unsd/methodology/m49/overview/
......
from django.db import models
from backend.models.country import Country
from backend.models.abstract.basic_module import BasicModule, BasicModuleSerializer, BasicModuleViewSet
from backend.utils import get_model_config, get_viewset_permissions
from backend_app.models.country import Country
from backend_app.models.abstract.basic_module import BasicModule, BasicModuleSerializer, BasicModuleViewSet
from backend_app.utils import get_model_config, get_viewset_permissions
class CountryDri(BasicModule):
......
from django.db import models
from backend.models.country import Country
from backend.models.abstract.scholarship import Scholarship, ScholarshipSerializer, ScholarshipViewSet
from backend.utils import get_model_config, get_viewset_permissions
from backend_app.models.country import Country
from backend_app.models.abstract.scholarship import Scholarship, ScholarshipSerializer, ScholarshipViewSet
from backend_app.utils import get_model_config, get_viewset_permissions
class CountryScholarship(Scholarship):
......
from django.db import models
from backend.models.abstract.taggedItem import TaggedItem, TaggedItemSerializer, TaggedItemViewSet
from backend.models.country import Country
from backend.utils import get_model_config, get_viewset_permissions
from backend_app.models.abstract.taggedItem import TaggedItem, TaggedItemSerializer, TaggedItemViewSet
from backend_app.models.country import Country
from backend_app.utils import get_model_config, get_viewset_permissions
class CountryTaggedItem(TaggedItem):
......
from django.db import models
from django.core.validators import MinValueValidator
from backend.models.abstract.my_model import MyModel, MyModelSerializer, MyModelViewSet
from backend.utils import get_model_config, get_viewset_permissions
from backend_app.models.abstract.my_model import MyModel, MyModelSerializer, MyModelViewSet
from backend_app.utils import get_model_config, get_viewset_permissions
class Currency(MyModel):
......
from django.db import models
from backend.models.abstract.my_model import MyModel, MyModelSerializer, MyModelViewSet
from backend.utils import get_model_config, get_viewset_permissions
from backend_app.models.abstract.my_model import MyModel, MyModelSerializer, MyModelViewSet
from backend_app.utils import get_model_config, get_viewset_permissions
class Department(MyModel):
......
from django.db import models
from backend.models.university import University
from backend.models.other_core import Semester, Specialty
from backend.models.abstract.my_model import MyModel, MyModelSerializer, MyModelViewSet
from backend.utils import get_model_config, get_viewset_permissions
from backend_app.models.university import University
from backend_app.models.other_core import Semester, Specialty
from backend_app.models.abstract.my_model import MyModel, MyModelSerializer, MyModelViewSet
from backend_app.utils import get_model_config, get_viewset_permissions
class Offer(MyModel):
......
from django.db import models
from backend.models.abstract.my_model import MyModel, MyModelSerializer, MyModelViewSet
from backend.utils import get_model_config, get_viewset_permissions
from backend_app.models.abstract.my_model import MyModel, MyModelSerializer, MyModelViewSet
from backend_app.utils import get_model_config, get_viewset_permissions
class Semester(MyModel):
......
from django.db import models
from backend.models.other_core import Department
from backend.models.abstract.my_model import MyModel, MyModelSerializer, MyModelViewSet
from backend.utils import get_model_config, get_viewset_permissions
from backend_app.models.other_core import Department
from backend_app.models.abstract.my_model import MyModel, MyModelSerializer, MyModelViewSet
from backend_app.utils import get_model_config, get_viewset_permissions
class Specialty(MyModel):
......
from django.db import models
from backend.models.abstract.my_model import MyModel, MyModelSerializer, MyModelViewSet
from backend.fields import JSONField
from backend.utils import get_viewset_permissions, get_model_config
from backend_app.models.abstract.my_model import MyModel, MyModelSerializer, MyModelViewSet
from backend_app.fields import JSONField
from backend_app.utils import get_viewset_permissions, get_model_config
class Tag(MyModel):
......
from django.db import models
from backend.models.abstract.my_model import MyModel
from backend.utils import get_model_config
from backend_app.models.abstract.my_model import MyModel
from backend_app.utils import get_model_config
from django.core.exceptions import ValidationError
from rest_framework.validators import ValidationError as RFValidationError
from backend.validators.tag.url import validate_extension
from backend_app.validators.tag.url import validate_extension
from django.conf import settings
from backend.models.abstract.my_model import MyModelSerializer, MyModelViewSet
from backend.utils import get_viewset_permissions
from backend_app.models.abstract.my_model import MyModelSerializer, MyModelViewSet
from backend_app.utils import get_viewset_permissions
def validate_extension_django(url):
......
from django.db import models
from backend.models.university import University
from backend.models.abstract.basic_module import BasicModule, BasicModuleSerializer, BasicModuleViewSet
from backend.utils import get_model_config, get_viewset_permissions
from backend_app.models.university import University
from backend_app.models.abstract.basic_module import BasicModule, BasicModuleSerializer, BasicModuleViewSet
from backend_app.utils import get_model_config, get_viewset_permissions
class UniversityDri(BasicModule):
......
from django.db import models
from backend.models.abstract.basic_module import BasicModule, BasicModuleSerializer, BasicModuleViewSet
from backend.models.university import University
from backend.models.currency import Currency
from backend_app.models.abstract.basic_module import BasicModule, BasicModuleSerializer, BasicModuleViewSet
from backend_app.models.university import University
from backend_app.models.currency import Currency
from django.core.validators import MinValueValidator
from backend.utils import get_model_config, get_viewset_permissions
from backend_app.utils import get_model_config, get_viewset_permissions
class UniversityInfo(BasicModule):
......
from django.db import models
from backend.models.university import University
from backend.models.abstract.scholarship import Scholarship, ScholarshipSerializer, ScholarshipViewSet
from backend.utils import get_model_config, get_viewset_permissions
from backend_app.models.university import University
from backend_app.models.abstract.scholarship import Scholarship, ScholarshipSerializer, ScholarshipViewSet
from backend_app.utils import get_model_config, get_viewset_permissions
class UniversityScholarship(Scholarship):
......
from django.db import models
from backend.models.abstract.basic_module import BasicModule, BasicModuleSerializer, BasicModuleViewSet
from backend.models.university import University
from backend_app.models.abstract.basic_module import BasicModule, BasicModuleSerializer, BasicModuleViewSet
from backend_app.models.university import University
from rest_framework import serializers
from backend.utils import get_model_config, get_viewset_permissions
from backend_app.utils import get_model_config, get_viewset_permissions
def semester_error(semester_name):
......
from django.db import models
from backend.models.abstract.taggedItem import TaggedItem, TaggedItemSerializer, TaggedItemViewSet
from backend.models.university import University
from backend.utils import get_model_config, get_viewset_permissions
from backend_app.models.abstract.taggedItem import TaggedItem, TaggedItemSerializer, TaggedItemViewSet
from backend_app.models.university import University
from backend_app.utils import get_model_config, get_viewset_permissions
class UniversityTaggedItem(TaggedItem):
......
from django.db import models
from backend.models.other_core.specialty import Specialty
from backend.models.other_core.semester import Semester
from backend.models.university import University
from backend_app.models.other_core.specialty import Specialty
from backend_app.models.other_core.semester import Semester
from backend_app.models.university import University
from django.contrib.auth.models import User
from backend.fields import JSONField
from backend.models.abstract.my_model import MyModel, MyModelSerializer, MyModelViewSet
from backend.utils import get_model_config, get_viewset_permissions
from backend_app.fields import JSONField
from backend_app.models.abstract.my_model import MyModel, MyModelSerializer, MyModelViewSet
from backend_app.utils import get_model_config, get_viewset_permissions
class PreviousDeparture(MyModel):
......
from django.db import models
from django.core.validators import MaxValueValidator
from backend.models.user import UserRestrictedModule, UserRestrictedModuleSerializer, UserRestrictedModuleViewSet
from backend.models.user import PreviousDeparture
from backend.fields import JSONField
from backend.utils import get_model_config, get_viewset_permissions
from backend_app.models.user import UserRestrictedModule, UserRestrictedModuleSerializer, UserRestrictedModuleViewSet
from backend_app.models.user import PreviousDeparture
from backend_app.fields import JSONField
from backend_app.utils import get_model_config, get_viewset_permissions
class PreviousDepartureFeedback(UserRestrictedModule):
......