commit df5ea18f235ddb995df940eec929b034e84ebc10 Author: louai98 Date: Thu Nov 28 16:06:12 2024 +0100 first commit diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..20ed10f --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,28 @@ + + +services: + server: + build: + context: ./salw_admin + dockerfile: Dockerfile + container_name: server + ports: + - "8000:8000" + networks: + - app-network + + web: + build: + context: ./salw_client + dockerfile: Dockerfile + container_name: web + ports: + - "3000:80" + networks: + - app-network + depends_on: + - server + +networks: + app-network: + driver: bridge \ No newline at end of file diff --git a/salw_admin/Dockerfile b/salw_admin/Dockerfile new file mode 100644 index 0000000..f248dc7 --- /dev/null +++ b/salw_admin/Dockerfile @@ -0,0 +1,20 @@ +# Back-End + +# Use the official Python image +FROM python:3.12 + +# Set working directory +WORKDIR /app + +# Install Python dependencies +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt + +# Copy the rest of the app files +COPY . . + +# Expose the port for the Django app +EXPOSE 8000 + +# Run the Django development server +CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"] \ No newline at end of file diff --git a/salw_admin/db.sqlite3 b/salw_admin/db.sqlite3 new file mode 100644 index 0000000..db9f8ad Binary files /dev/null and b/salw_admin/db.sqlite3 differ diff --git a/salw_admin/manage.py b/salw_admin/manage.py new file mode 100755 index 0000000..5418c7f --- /dev/null +++ b/salw_admin/manage.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +"""Django's command-line utility for administrative tasks.""" +import os +import sys + + +def main(): + """Run administrative tasks.""" + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'salw_admin.settings') + try: + from django.core.management import execute_from_command_line + except ImportError as exc: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) from exc + execute_from_command_line(sys.argv) + + +if __name__ == '__main__': + main() diff --git a/salw_admin/pssm_api/__init__.py b/salw_admin/pssm_api/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/salw_admin/pssm_api/__pycache__/__init__.cpython-310.pyc b/salw_admin/pssm_api/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000..7c29637 Binary files /dev/null and b/salw_admin/pssm_api/__pycache__/__init__.cpython-310.pyc differ diff --git a/salw_admin/pssm_api/__pycache__/__init__.cpython-38.pyc b/salw_admin/pssm_api/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000..41b966e Binary files /dev/null and b/salw_admin/pssm_api/__pycache__/__init__.cpython-38.pyc differ diff --git a/salw_admin/pssm_api/__pycache__/admin.cpython-310.pyc b/salw_admin/pssm_api/__pycache__/admin.cpython-310.pyc new file mode 100644 index 0000000..353fbc1 Binary files /dev/null and b/salw_admin/pssm_api/__pycache__/admin.cpython-310.pyc differ diff --git a/salw_admin/pssm_api/__pycache__/admin.cpython-38.pyc b/salw_admin/pssm_api/__pycache__/admin.cpython-38.pyc new file mode 100644 index 0000000..c61bac3 Binary files /dev/null and b/salw_admin/pssm_api/__pycache__/admin.cpython-38.pyc differ diff --git a/salw_admin/pssm_api/__pycache__/apps.cpython-310.pyc b/salw_admin/pssm_api/__pycache__/apps.cpython-310.pyc new file mode 100644 index 0000000..caf9fb7 Binary files /dev/null and b/salw_admin/pssm_api/__pycache__/apps.cpython-310.pyc differ diff --git a/salw_admin/pssm_api/__pycache__/apps.cpython-38.pyc b/salw_admin/pssm_api/__pycache__/apps.cpython-38.pyc new file mode 100644 index 0000000..29caaf1 Binary files /dev/null and b/salw_admin/pssm_api/__pycache__/apps.cpython-38.pyc differ diff --git a/salw_admin/pssm_api/__pycache__/models.cpython-310.pyc b/salw_admin/pssm_api/__pycache__/models.cpython-310.pyc new file mode 100644 index 0000000..e715ea4 Binary files /dev/null and b/salw_admin/pssm_api/__pycache__/models.cpython-310.pyc differ diff --git a/salw_admin/pssm_api/__pycache__/models.cpython-38.pyc b/salw_admin/pssm_api/__pycache__/models.cpython-38.pyc new file mode 100644 index 0000000..2178448 Binary files /dev/null and b/salw_admin/pssm_api/__pycache__/models.cpython-38.pyc differ diff --git a/salw_admin/pssm_api/__pycache__/serializers.cpython-310.pyc b/salw_admin/pssm_api/__pycache__/serializers.cpython-310.pyc new file mode 100644 index 0000000..934154e Binary files /dev/null and b/salw_admin/pssm_api/__pycache__/serializers.cpython-310.pyc differ diff --git a/salw_admin/pssm_api/__pycache__/serializers.cpython-38.pyc b/salw_admin/pssm_api/__pycache__/serializers.cpython-38.pyc new file mode 100644 index 0000000..efc22d3 Binary files /dev/null and b/salw_admin/pssm_api/__pycache__/serializers.cpython-38.pyc differ diff --git a/salw_admin/pssm_api/__pycache__/signals.cpython-310.pyc b/salw_admin/pssm_api/__pycache__/signals.cpython-310.pyc new file mode 100644 index 0000000..494e624 Binary files /dev/null and b/salw_admin/pssm_api/__pycache__/signals.cpython-310.pyc differ diff --git a/salw_admin/pssm_api/__pycache__/signals.cpython-38.pyc b/salw_admin/pssm_api/__pycache__/signals.cpython-38.pyc new file mode 100644 index 0000000..034d17f Binary files /dev/null and b/salw_admin/pssm_api/__pycache__/signals.cpython-38.pyc differ diff --git a/salw_admin/pssm_api/__pycache__/urls.cpython-310.pyc b/salw_admin/pssm_api/__pycache__/urls.cpython-310.pyc new file mode 100644 index 0000000..9b78a24 Binary files /dev/null and b/salw_admin/pssm_api/__pycache__/urls.cpython-310.pyc differ diff --git a/salw_admin/pssm_api/__pycache__/urls.cpython-38.pyc b/salw_admin/pssm_api/__pycache__/urls.cpython-38.pyc new file mode 100644 index 0000000..2652c4b Binary files /dev/null and b/salw_admin/pssm_api/__pycache__/urls.cpython-38.pyc differ diff --git a/salw_admin/pssm_api/__pycache__/views.cpython-310.pyc b/salw_admin/pssm_api/__pycache__/views.cpython-310.pyc new file mode 100644 index 0000000..78abd67 Binary files /dev/null and b/salw_admin/pssm_api/__pycache__/views.cpython-310.pyc differ diff --git a/salw_admin/pssm_api/__pycache__/views.cpython-38.pyc b/salw_admin/pssm_api/__pycache__/views.cpython-38.pyc new file mode 100644 index 0000000..5a81469 Binary files /dev/null and b/salw_admin/pssm_api/__pycache__/views.cpython-38.pyc differ diff --git a/salw_admin/pssm_api/admin.py b/salw_admin/pssm_api/admin.py new file mode 100644 index 0000000..2db93cb --- /dev/null +++ b/salw_admin/pssm_api/admin.py @@ -0,0 +1,24 @@ +from django.contrib import admin +from .models import Images, Impact_Stories, PSSM_Resources, African_Countries, PSSM_Countries +# Register your models here. +@admin.register(Images) +class ImagesAdmin(admin.ModelAdmin): + list_display = ('title', 'image') + +@admin.register(Impact_Stories) +class Impact_StoriesAdmin(admin.ModelAdmin): + list_display = ('title', 'file') + +@admin.register(PSSM_Resources) +class PSSM_ResourcesAdmin(admin.ModelAdmin): + list_display = ('title', 'file') + +@admin.register(African_Countries) +class African_CountriesAdmin(admin.ModelAdmin): + display = ('name') + ordering = ('name',) + +@admin.register(PSSM_Countries) +class PSSM_CountriesAdmin(admin.ModelAdmin): + list_display = ('country', 'recsa', 'ecowas') + ordering = ('recsa', 'ecowas','country') \ No newline at end of file diff --git a/salw_admin/pssm_api/apps.py b/salw_admin/pssm_api/apps.py new file mode 100644 index 0000000..0ee0f09 --- /dev/null +++ b/salw_admin/pssm_api/apps.py @@ -0,0 +1,9 @@ +from django.apps import AppConfig + + +class PssmApiConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'pssm_api' + + def ready(self): + import pssm_api.signals \ No newline at end of file diff --git a/salw_admin/pssm_api/migrations/0001_initial.py b/salw_admin/pssm_api/migrations/0001_initial.py new file mode 100644 index 0000000..e9edc7e --- /dev/null +++ b/salw_admin/pssm_api/migrations/0001_initial.py @@ -0,0 +1,67 @@ +# Generated by Django 4.2.16 on 2024-10-16 07:58 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='African_Countries', + fields=[ + ('country_id', models.IntegerField(primary_key=True, serialize=False, unique=True)), + ('name', models.CharField(max_length=50)), + ('iso', models.CharField(default='', max_length=5)), + ], + ), + migrations.CreateModel( + name='Images', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=200)), + ('image', models.ImageField(upload_to='images/')), + ('copyright', models.CharField(max_length=200)), + ('description', models.TextField(blank=True)), + ('uploaded_at', models.DateTimeField(auto_now_add=True)), + ], + ), + migrations.CreateModel( + name='Impact_Stories', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=200)), + ('file', models.FileField(upload_to='impact_stories/')), + ('uploaded_at', models.DateTimeField(auto_now_add=True)), + ('description', models.TextField(blank=True)), + ], + ), + migrations.CreateModel( + name='PSSM_Resources', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=200)), + ('file', models.FileField(upload_to='pssm_resources/')), + ('uploaded_at', models.DateTimeField(auto_now_add=True)), + ('description', models.TextField(blank=True)), + ], + ), + migrations.CreateModel( + name='PSSM_Countries', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('recsa', models.BooleanField(default=False)), + ('ecowas', models.BooleanField(default=False)), + ('trained_participants', models.IntegerField(help_text='Number of participants trained')), + ('pssm_instractors', models.IntegerField(help_text='Number of PSSM instractors')), + ('senior_pssm_instractors', models.IntegerField(help_text='Number of senior PSSM instractors')), + ('modefied_at', models.DateTimeField(auto_now_add=True)), + ('country', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='pssm_api.african_countries')), + ], + ), + ] diff --git a/salw_admin/pssm_api/migrations/0002_rename_country_id_african_countries_id.py b/salw_admin/pssm_api/migrations/0002_rename_country_id_african_countries_id.py new file mode 100644 index 0000000..940a376 --- /dev/null +++ b/salw_admin/pssm_api/migrations/0002_rename_country_id_african_countries_id.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.16 on 2024-10-16 08:01 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('pssm_api', '0001_initial'), + ] + + operations = [ + migrations.RenameField( + model_name='african_countries', + old_name='country_id', + new_name='id', + ), + ] diff --git a/salw_admin/pssm_api/migrations/__init__.py b/salw_admin/pssm_api/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/salw_admin/pssm_api/migrations/__pycache__/0001_initial.cpython-310.pyc b/salw_admin/pssm_api/migrations/__pycache__/0001_initial.cpython-310.pyc new file mode 100644 index 0000000..6e43948 Binary files /dev/null and b/salw_admin/pssm_api/migrations/__pycache__/0001_initial.cpython-310.pyc differ diff --git a/salw_admin/pssm_api/migrations/__pycache__/0001_initial.cpython-38.pyc b/salw_admin/pssm_api/migrations/__pycache__/0001_initial.cpython-38.pyc new file mode 100644 index 0000000..ef1ab7a Binary files /dev/null and b/salw_admin/pssm_api/migrations/__pycache__/0001_initial.cpython-38.pyc differ diff --git a/salw_admin/pssm_api/migrations/__pycache__/0002_rename_country_id_african_countries_id.cpython-310.pyc b/salw_admin/pssm_api/migrations/__pycache__/0002_rename_country_id_african_countries_id.cpython-310.pyc new file mode 100644 index 0000000..af79097 Binary files /dev/null and b/salw_admin/pssm_api/migrations/__pycache__/0002_rename_country_id_african_countries_id.cpython-310.pyc differ diff --git a/salw_admin/pssm_api/migrations/__pycache__/0002_rename_country_id_african_countries_id.cpython-38.pyc b/salw_admin/pssm_api/migrations/__pycache__/0002_rename_country_id_african_countries_id.cpython-38.pyc new file mode 100644 index 0000000..29069da Binary files /dev/null and b/salw_admin/pssm_api/migrations/__pycache__/0002_rename_country_id_african_countries_id.cpython-38.pyc differ diff --git a/salw_admin/pssm_api/migrations/__pycache__/__init__.cpython-310.pyc b/salw_admin/pssm_api/migrations/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000..fc6a97a Binary files /dev/null and b/salw_admin/pssm_api/migrations/__pycache__/__init__.cpython-310.pyc differ diff --git a/salw_admin/pssm_api/migrations/__pycache__/__init__.cpython-38.pyc b/salw_admin/pssm_api/migrations/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000..4a575de Binary files /dev/null and b/salw_admin/pssm_api/migrations/__pycache__/__init__.cpython-38.pyc differ diff --git a/salw_admin/pssm_api/models.py b/salw_admin/pssm_api/models.py new file mode 100644 index 0000000..2c8f20f --- /dev/null +++ b/salw_admin/pssm_api/models.py @@ -0,0 +1,52 @@ +from django.db import models +import os + +# Create your models here. +class Images(models.Model): + title = models.CharField(max_length=200) + image = models.ImageField(upload_to='images/') + copyright = models.CharField(max_length=200) + description = models.TextField(blank=True) + uploaded_at = models.DateTimeField(auto_now_add=True) + + def __str__(self) -> str: + return self.title + +class Impact_Stories(models.Model): + title = models.CharField(max_length=200) + file = models.FileField(upload_to='impact_stories/') + uploaded_at = models.DateTimeField(auto_now_add=True) + description = models.TextField(blank=True) + + def __str__(self) -> str: + return self.title + + +class PSSM_Resources(models.Model): + title = models.CharField(max_length=200) + file = models.FileField(upload_to='pssm_resources/') + uploaded_at = models.DateTimeField(auto_now_add=True) + description = models.TextField(blank=True) + + def __str__(self) -> str: + return self.title + +class African_Countries(models.Model): + id = models.IntegerField(primary_key=True, unique=True) + name = models.CharField(max_length=50) + iso = models.CharField(max_length=5, default="") + + def __str__(self) -> int: + return self.name + +class PSSM_Countries(models.Model): + country = models.ForeignKey(African_Countries, on_delete=models.CASCADE) + recsa = models.BooleanField(default=False) + ecowas = models.BooleanField(default=False) + trained_participants = models.IntegerField(help_text="Number of participants trained") + pssm_instractors = models.IntegerField(help_text="Number of PSSM instractors") + senior_pssm_instractors = models.IntegerField(help_text="Number of senior PSSM instractors") + modefied_at = models.DateTimeField(auto_now_add=True, blank=True) + + def __str__(self) -> str: + return self.country.name \ No newline at end of file diff --git a/salw_admin/pssm_api/serializers.py b/salw_admin/pssm_api/serializers.py new file mode 100644 index 0000000..b6d43c4 --- /dev/null +++ b/salw_admin/pssm_api/serializers.py @@ -0,0 +1,7 @@ +from rest_framework import serializers +from .models import PSSM_Countries + +class PssmCountriesSerializer(serializers.ModelSerializer): + class Meta: + model = PSSM_Countries + fields = '__all__' # Serialize all fields; you can specify a subset if preferred \ No newline at end of file diff --git a/salw_admin/pssm_api/signals.py b/salw_admin/pssm_api/signals.py new file mode 100644 index 0000000..1e3f46b --- /dev/null +++ b/salw_admin/pssm_api/signals.py @@ -0,0 +1,26 @@ +from django.db.models.signals import post_delete +from django.dispatch import receiver +from .models import Images, Impact_Stories, PSSM_Resources +import os + +@receiver(post_delete, sender=Images) +def delete_image_file(sender, instance, **kwargs): + # Check if the image file exists and delete it + if instance.image: + if os.path.isfile(instance.image.path): + os.remove(instance.image.path) + +@receiver(post_delete, sender=Impact_Stories) +def delete_impact_story_file(sender, instance, **kwargs): + # Check if the image file exists and delete it + if instance.file: + if os.path.isfile(instance.file.path): + os.remove(instance.file.path) + +@receiver(post_delete, sender=PSSM_Resources) +def delete_pssm_resources_file(sender, instance, **kwargs): + # Check if the image file exists and delete it + if instance.file: + if os.path.isfile(instance.file.path): + os.remove(instance.file.path) + diff --git a/salw_admin/pssm_api/tests.py b/salw_admin/pssm_api/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/salw_admin/pssm_api/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/salw_admin/pssm_api/urls.py b/salw_admin/pssm_api/urls.py new file mode 100644 index 0000000..48547a4 --- /dev/null +++ b/salw_admin/pssm_api/urls.py @@ -0,0 +1,10 @@ +from django.urls import path +from .views import PssmCountriesListView +# Import views from pssm_api (create them in views.py if needed) +from . import views + +urlpatterns = [ + # Example URL pattern + # path('', views.index, name='index'), + path('api/countries/', PssmCountriesListView.as_view(), name='countries-list'), +] \ No newline at end of file diff --git a/salw_admin/pssm_api/views.py b/salw_admin/pssm_api/views.py new file mode 100644 index 0000000..0f8b137 --- /dev/null +++ b/salw_admin/pssm_api/views.py @@ -0,0 +1,10 @@ +from django.shortcuts import render +from rest_framework import generics +from .models import PSSM_Countries +from .serializers import PssmCountriesSerializer + +# Create your views here. + +class PssmCountriesListView(generics.ListAPIView): + queryset = PSSM_Countries.objects.all() + serializer_class = PssmCountriesSerializer \ No newline at end of file diff --git a/salw_admin/requirements.txt b/salw_admin/requirements.txt new file mode 100644 index 0000000..c27196b --- /dev/null +++ b/salw_admin/requirements.txt @@ -0,0 +1,4 @@ +Django==4.2.16 +django-cors-headers==4.4.0 +djangorestframework==3.15.2 +pillow==10.4.0 \ No newline at end of file diff --git a/salw_admin/salw_admin/__init__.py b/salw_admin/salw_admin/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/salw_admin/salw_admin/__pycache__/__init__.cpython-310.pyc b/salw_admin/salw_admin/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000..0d4af26 Binary files /dev/null and b/salw_admin/salw_admin/__pycache__/__init__.cpython-310.pyc differ diff --git a/salw_admin/salw_admin/__pycache__/__init__.cpython-38.pyc b/salw_admin/salw_admin/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000..ef67fc4 Binary files /dev/null and b/salw_admin/salw_admin/__pycache__/__init__.cpython-38.pyc differ diff --git a/salw_admin/salw_admin/__pycache__/settings.cpython-310.pyc b/salw_admin/salw_admin/__pycache__/settings.cpython-310.pyc new file mode 100644 index 0000000..8edca05 Binary files /dev/null and b/salw_admin/salw_admin/__pycache__/settings.cpython-310.pyc differ diff --git a/salw_admin/salw_admin/__pycache__/settings.cpython-38.pyc b/salw_admin/salw_admin/__pycache__/settings.cpython-38.pyc new file mode 100644 index 0000000..35234bd Binary files /dev/null and b/salw_admin/salw_admin/__pycache__/settings.cpython-38.pyc differ diff --git a/salw_admin/salw_admin/__pycache__/urls.cpython-310.pyc b/salw_admin/salw_admin/__pycache__/urls.cpython-310.pyc new file mode 100644 index 0000000..fd4f8d8 Binary files /dev/null and b/salw_admin/salw_admin/__pycache__/urls.cpython-310.pyc differ diff --git a/salw_admin/salw_admin/__pycache__/urls.cpython-38.pyc b/salw_admin/salw_admin/__pycache__/urls.cpython-38.pyc new file mode 100644 index 0000000..7327724 Binary files /dev/null and b/salw_admin/salw_admin/__pycache__/urls.cpython-38.pyc differ diff --git a/salw_admin/salw_admin/__pycache__/wsgi.cpython-310.pyc b/salw_admin/salw_admin/__pycache__/wsgi.cpython-310.pyc new file mode 100644 index 0000000..b339ffc Binary files /dev/null and b/salw_admin/salw_admin/__pycache__/wsgi.cpython-310.pyc differ diff --git a/salw_admin/salw_admin/__pycache__/wsgi.cpython-38.pyc b/salw_admin/salw_admin/__pycache__/wsgi.cpython-38.pyc new file mode 100644 index 0000000..6e8f515 Binary files /dev/null and b/salw_admin/salw_admin/__pycache__/wsgi.cpython-38.pyc differ diff --git a/salw_admin/salw_admin/asgi.py b/salw_admin/salw_admin/asgi.py new file mode 100644 index 0000000..6a54e72 --- /dev/null +++ b/salw_admin/salw_admin/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for salw_admin project. + +It exposes the ASGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'salw_admin.settings') + +application = get_asgi_application() diff --git a/salw_admin/salw_admin/settings.py b/salw_admin/salw_admin/settings.py new file mode 100644 index 0000000..cd6adf7 --- /dev/null +++ b/salw_admin/salw_admin/settings.py @@ -0,0 +1,136 @@ +""" +Django settings for salw_admin project. + +Generated by 'django-admin startproject' using Django 4.2.16. + +For more information on this file, see +https://docs.djangoproject.com/en/4.2/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/4.2/ref/settings/ +""" + +from pathlib import Path + +# Build paths inside the project like this: BASE_DIR / 'subdir'. +BASE_DIR = Path(__file__).resolve().parent.parent + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'django-insecure-6yko*@^lc2cz(nbdt(x!&7z8x8tqp_@ymqu*_-bk-52wi1@ugf' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = [] + + +# Application definition + +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + 'corsheaders', + 'rest_framework', + 'pssm_api', + #'pssm_api.apps.PssmApiConfig' +] + +MIDDLEWARE = [ + 'corsheaders.middleware.CorsMiddleware', + 'django.middleware.security.SecurityMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', +] + +CORS_ALLOWED_ORIGINS = [ + "http://localhost:3000", # URL of your React app +] + +ROOT_URLCONF = 'salw_admin.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'salw_admin.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/4.2/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': BASE_DIR / 'db.sqlite3', + } +} + + +# Password validation +# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + }, +] + + +# Internationalization +# https://docs.djangoproject.com/en/4.2/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/4.2/howto/static-files/ + +STATIC_URL = 'static/' + +# Media settings +MEDIA_URL = '/media/' +MEDIA_ROOT = BASE_DIR / 'media' + +# Default primary key field type +# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field + +DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' \ No newline at end of file diff --git a/salw_admin/salw_admin/urls.py b/salw_admin/salw_admin/urls.py new file mode 100644 index 0000000..9f95ff9 --- /dev/null +++ b/salw_admin/salw_admin/urls.py @@ -0,0 +1,23 @@ +""" +URL configuration for salw_admin project. + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/4.2/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: path('', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') +Including another URLconf + 1. Import the include() function: from django.urls import include, path + 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) +""" +from django.contrib import admin +from django.urls import path, include + +urlpatterns = [ + path('admin/', admin.site.urls), + path('pssm_app/', include('pssm_api.urls')), +] diff --git a/salw_admin/salw_admin/wsgi.py b/salw_admin/salw_admin/wsgi.py new file mode 100644 index 0000000..ea12e62 --- /dev/null +++ b/salw_admin/salw_admin/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for salw_admin project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'salw_admin.settings') + +application = get_wsgi_application() diff --git a/salw_client b/salw_client new file mode 160000 index 0000000..cc6300f --- /dev/null +++ b/salw_client @@ -0,0 +1 @@ +Subproject commit cc6300ff991102504bb18cdb59a8965dad50c0ac