first commit
This commit is contained in:
commit
df5ea18f23
28
docker-compose.yml
Normal file
28
docker-compose.yml
Normal file
@ -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
|
20
salw_admin/Dockerfile
Normal file
20
salw_admin/Dockerfile
Normal file
@ -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"]
|
BIN
salw_admin/db.sqlite3
Normal file
BIN
salw_admin/db.sqlite3
Normal file
Binary file not shown.
22
salw_admin/manage.py
Executable file
22
salw_admin/manage.py
Executable file
@ -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()
|
0
salw_admin/pssm_api/__init__.py
Normal file
0
salw_admin/pssm_api/__init__.py
Normal file
BIN
salw_admin/pssm_api/__pycache__/__init__.cpython-310.pyc
Normal file
BIN
salw_admin/pssm_api/__pycache__/__init__.cpython-310.pyc
Normal file
Binary file not shown.
BIN
salw_admin/pssm_api/__pycache__/__init__.cpython-38.pyc
Normal file
BIN
salw_admin/pssm_api/__pycache__/__init__.cpython-38.pyc
Normal file
Binary file not shown.
BIN
salw_admin/pssm_api/__pycache__/admin.cpython-310.pyc
Normal file
BIN
salw_admin/pssm_api/__pycache__/admin.cpython-310.pyc
Normal file
Binary file not shown.
BIN
salw_admin/pssm_api/__pycache__/admin.cpython-38.pyc
Normal file
BIN
salw_admin/pssm_api/__pycache__/admin.cpython-38.pyc
Normal file
Binary file not shown.
BIN
salw_admin/pssm_api/__pycache__/apps.cpython-310.pyc
Normal file
BIN
salw_admin/pssm_api/__pycache__/apps.cpython-310.pyc
Normal file
Binary file not shown.
BIN
salw_admin/pssm_api/__pycache__/apps.cpython-38.pyc
Normal file
BIN
salw_admin/pssm_api/__pycache__/apps.cpython-38.pyc
Normal file
Binary file not shown.
BIN
salw_admin/pssm_api/__pycache__/models.cpython-310.pyc
Normal file
BIN
salw_admin/pssm_api/__pycache__/models.cpython-310.pyc
Normal file
Binary file not shown.
BIN
salw_admin/pssm_api/__pycache__/models.cpython-38.pyc
Normal file
BIN
salw_admin/pssm_api/__pycache__/models.cpython-38.pyc
Normal file
Binary file not shown.
BIN
salw_admin/pssm_api/__pycache__/serializers.cpython-310.pyc
Normal file
BIN
salw_admin/pssm_api/__pycache__/serializers.cpython-310.pyc
Normal file
Binary file not shown.
BIN
salw_admin/pssm_api/__pycache__/serializers.cpython-38.pyc
Normal file
BIN
salw_admin/pssm_api/__pycache__/serializers.cpython-38.pyc
Normal file
Binary file not shown.
BIN
salw_admin/pssm_api/__pycache__/signals.cpython-310.pyc
Normal file
BIN
salw_admin/pssm_api/__pycache__/signals.cpython-310.pyc
Normal file
Binary file not shown.
BIN
salw_admin/pssm_api/__pycache__/signals.cpython-38.pyc
Normal file
BIN
salw_admin/pssm_api/__pycache__/signals.cpython-38.pyc
Normal file
Binary file not shown.
BIN
salw_admin/pssm_api/__pycache__/urls.cpython-310.pyc
Normal file
BIN
salw_admin/pssm_api/__pycache__/urls.cpython-310.pyc
Normal file
Binary file not shown.
BIN
salw_admin/pssm_api/__pycache__/urls.cpython-38.pyc
Normal file
BIN
salw_admin/pssm_api/__pycache__/urls.cpython-38.pyc
Normal file
Binary file not shown.
BIN
salw_admin/pssm_api/__pycache__/views.cpython-310.pyc
Normal file
BIN
salw_admin/pssm_api/__pycache__/views.cpython-310.pyc
Normal file
Binary file not shown.
BIN
salw_admin/pssm_api/__pycache__/views.cpython-38.pyc
Normal file
BIN
salw_admin/pssm_api/__pycache__/views.cpython-38.pyc
Normal file
Binary file not shown.
24
salw_admin/pssm_api/admin.py
Normal file
24
salw_admin/pssm_api/admin.py
Normal file
@ -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')
|
9
salw_admin/pssm_api/apps.py
Normal file
9
salw_admin/pssm_api/apps.py
Normal file
@ -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
|
67
salw_admin/pssm_api/migrations/0001_initial.py
Normal file
67
salw_admin/pssm_api/migrations/0001_initial.py
Normal file
@ -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')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
@ -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',
|
||||||
|
),
|
||||||
|
]
|
0
salw_admin/pssm_api/migrations/__init__.py
Normal file
0
salw_admin/pssm_api/migrations/__init__.py
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
52
salw_admin/pssm_api/models.py
Normal file
52
salw_admin/pssm_api/models.py
Normal file
@ -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
|
7
salw_admin/pssm_api/serializers.py
Normal file
7
salw_admin/pssm_api/serializers.py
Normal file
@ -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
|
26
salw_admin/pssm_api/signals.py
Normal file
26
salw_admin/pssm_api/signals.py
Normal file
@ -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)
|
||||||
|
|
3
salw_admin/pssm_api/tests.py
Normal file
3
salw_admin/pssm_api/tests.py
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
# Create your tests here.
|
10
salw_admin/pssm_api/urls.py
Normal file
10
salw_admin/pssm_api/urls.py
Normal file
@ -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'),
|
||||||
|
]
|
10
salw_admin/pssm_api/views.py
Normal file
10
salw_admin/pssm_api/views.py
Normal file
@ -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
|
4
salw_admin/requirements.txt
Normal file
4
salw_admin/requirements.txt
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
Django==4.2.16
|
||||||
|
django-cors-headers==4.4.0
|
||||||
|
djangorestframework==3.15.2
|
||||||
|
pillow==10.4.0
|
0
salw_admin/salw_admin/__init__.py
Normal file
0
salw_admin/salw_admin/__init__.py
Normal file
BIN
salw_admin/salw_admin/__pycache__/__init__.cpython-310.pyc
Normal file
BIN
salw_admin/salw_admin/__pycache__/__init__.cpython-310.pyc
Normal file
Binary file not shown.
BIN
salw_admin/salw_admin/__pycache__/__init__.cpython-38.pyc
Normal file
BIN
salw_admin/salw_admin/__pycache__/__init__.cpython-38.pyc
Normal file
Binary file not shown.
BIN
salw_admin/salw_admin/__pycache__/settings.cpython-310.pyc
Normal file
BIN
salw_admin/salw_admin/__pycache__/settings.cpython-310.pyc
Normal file
Binary file not shown.
BIN
salw_admin/salw_admin/__pycache__/settings.cpython-38.pyc
Normal file
BIN
salw_admin/salw_admin/__pycache__/settings.cpython-38.pyc
Normal file
Binary file not shown.
BIN
salw_admin/salw_admin/__pycache__/urls.cpython-310.pyc
Normal file
BIN
salw_admin/salw_admin/__pycache__/urls.cpython-310.pyc
Normal file
Binary file not shown.
BIN
salw_admin/salw_admin/__pycache__/urls.cpython-38.pyc
Normal file
BIN
salw_admin/salw_admin/__pycache__/urls.cpython-38.pyc
Normal file
Binary file not shown.
BIN
salw_admin/salw_admin/__pycache__/wsgi.cpython-310.pyc
Normal file
BIN
salw_admin/salw_admin/__pycache__/wsgi.cpython-310.pyc
Normal file
Binary file not shown.
BIN
salw_admin/salw_admin/__pycache__/wsgi.cpython-38.pyc
Normal file
BIN
salw_admin/salw_admin/__pycache__/wsgi.cpython-38.pyc
Normal file
Binary file not shown.
16
salw_admin/salw_admin/asgi.py
Normal file
16
salw_admin/salw_admin/asgi.py
Normal file
@ -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()
|
136
salw_admin/salw_admin/settings.py
Normal file
136
salw_admin/salw_admin/settings.py
Normal file
@ -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'
|
23
salw_admin/salw_admin/urls.py
Normal file
23
salw_admin/salw_admin/urls.py
Normal file
@ -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')),
|
||||||
|
]
|
16
salw_admin/salw_admin/wsgi.py
Normal file
16
salw_admin/salw_admin/wsgi.py
Normal file
@ -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()
|
1
salw_client
Submodule
1
salw_client
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit cc6300ff991102504bb18cdb59a8965dad50c0ac
|
Loading…
Reference in New Issue
Block a user