Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion accounts/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 3.2 on 2021-05-06 07:02
# Generated by Django 3.2 on 2021-06-18 13:10

from django.conf import settings
from django.db import migrations, models
Expand All @@ -19,6 +19,10 @@ class Migration(migrations.Migration):
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('phone', models.CharField(max_length=12, null=True, unique=True)),
('status', models.CharField(max_length=32, null=True)),
('company', models.CharField(max_length=32, null=True)),
('bio', models.TextField(null=True)),
('image', models.ImageField(default='default.jpg', upload_to='profile_pics')),
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
Expand Down
33 changes: 0 additions & 33 deletions accounts/migrations/0002_auto_20210506_2016.py

This file was deleted.

Binary file modified accounts/migrations/__pycache__/0001_initial.cpython-38.pyc
Binary file not shown.
23 changes: 21 additions & 2 deletions announcements/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 3.2 on 2021-05-25 07:46
# Generated by Django 3.2 on 2021-06-18 13:10

from django.conf import settings
from django.db import migrations, models
Expand All @@ -10,8 +10,8 @@ class Migration(migrations.Migration):
initial = True

dependencies = [
('classrooms', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('classrooms', '0012_classroom_is_active'),
]

operations = [
Expand All @@ -25,6 +25,15 @@ class Migration(migrations.Migration):
('classroom', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='classrooms.classroom')),
],
),
migrations.CreateModel(
name='MessageAdmin',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('content', models.CharField(max_length=2048)),
('date_posted', models.DateTimeField(auto_now_add=True)),
('classroom', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='classrooms.classroom')),
],
),
migrations.CreateModel(
name='AnnouncementUser',
fields=[
Expand All @@ -34,4 +43,14 @@ class Migration(migrations.Migration):
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='AnnouncementAdmin',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('headline', models.CharField(max_length=64)),
('content', models.CharField(max_length=512)),
('date_posted', models.DateTimeField(auto_now_add=True)),
('classroom', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='classrooms.classroom')),
],
),
]
35 changes: 0 additions & 35 deletions announcements/migrations/0002_announcementadmin_messageadmin.py

This file was deleted.

17 changes: 0 additions & 17 deletions announcements/migrations/0003_remove_messageadmin_subject.py

This file was deleted.

18 changes: 0 additions & 18 deletions announcements/migrations/0004_alter_messageadmin_content.py

This file was deleted.

Binary file modified announcements/migrations/__pycache__/0001_initial.cpython-38.pyc
Binary file not shown.
Binary file modified classroom/__pycache__/asgi.cpython-38.pyc
Binary file not shown.
Binary file added classroom/__pycache__/routing.cpython-38.pyc
Binary file not shown.
Binary file modified classroom/__pycache__/secret.cpython-38.pyc
Binary file not shown.
Binary file modified classroom/__pycache__/settings.cpython-38.pyc
Binary file not shown.
26 changes: 11 additions & 15 deletions classroom/asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,17 @@
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/
"""
import os

from channels.routing import ProtocolTypeRouter, URLRouter
from django.core.asgi import get_asgi_application
from channels.auth import AuthMiddlewareStack
import chat.routing
"""
ASGI entrypoint. Configures Django and then runs the application
defined in the ASGI_APPLICATION setting.
"""

import os
import django
from channels.routing import get_default_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", 'classroom.settings')
django.setup()
application = get_default_application()

application = ProtocolTypeRouter({
"http": get_asgi_application(),
# Just HTTP for now. (We can add other protocols later.)
"websocket": AuthMiddlewareStack(
URLRouter(
chat.routing.websocket_urlpatterns
)
),
})
18 changes: 18 additions & 0 deletions classroom/routing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import os

from channels.routing import ProtocolTypeRouter, URLRouter
from django.core.asgi import get_asgi_application
from channels.auth import AuthMiddlewareStack
import chat.routing

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'classroom.settings')

application = ProtocolTypeRouter({
"http": get_asgi_application(),
# Just HTTP for now. (We can add other protocols later.)
"websocket": AuthMiddlewareStack(
URLRouter(
chat.routing.websocket_urlpatterns
)
),
})
53 changes: 40 additions & 13 deletions classroom/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from pathlib import Path
import os
from . import secret
from decouple import config

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
Expand All @@ -21,13 +22,16 @@
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = secret.sec
SECRET_KEY = config('SECRET_KEY')

# SECURITY WARNING: don't run with debug turned on in production!

# DEBUG = config('DEBUG', default=False, cast=bool)
DEBUG = True

ALLOWED_HOSTS = []
ALLOWED_HOSTS = ["143.110.246.81",'*']

ROOT_URLCONF = f'{config("PROJECT_NAME")}.urls'


# Application definition
Expand Down Expand Up @@ -73,8 +77,6 @@
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'classroom.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
Expand All @@ -92,8 +94,9 @@
},
]

WSGI_APPLICATION = 'classroom.wsgi.application'

WSGI_APPLICATION = 'classroom.wsgi.application'
ASGI_APPLICATION = 'classroom.routing.application'

# Database
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
Expand Down Expand Up @@ -148,19 +151,44 @@

USE_TZ = False

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.2/howto/static-files/


MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': config("DB_NAME"),
'USER': config("DB_USER"),
'PASSWORD': config("DB_PASSWORD"),
'HOST': 'localhost',
'PORT': '',
}
}

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.2/howto/static-files/
AWS_ACCESS_KEY_ID = config('AWS_ACCESS_KEY_ID')
AWS_SECRET_ACCESS_KEY = config('AWS_SECRET_ACCESS_KEY')
AWS_STORAGE_BUCKET_NAME = config('AWS_STORAGE_BUCKET_NAME')
AWS_S3_ENDPOINT_URL = config('AWS_S3_ENDPOINT_URL')
AWS_S3_OBJECT_PARAMETERS = {
'CacheControl': 'max-age=86400',
}
AWS_LOCATION = config('AWS_LOCATION')

STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static')
os.path.join(BASE_DIR, 'static'),
]

#STATIC_ROOT = os.path.join(BASE_DIR, 'static/')
STATIC_URL = 'https://%s/%s/' % (AWS_S3_ENDPOINT_URL, AWS_LOCATION)
TEMP = os.path.join(BASE_DIR, 'temp')
STATICFILES_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'



BASE_URL = "http://143.110.246.81"

# Default primary key field type
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field

Expand All @@ -174,7 +202,6 @@


# Channels
ASGI_APPLICATION = 'classroom.asgi.application'

CHANNEL_LAYERS = {
"default": {
Expand Down
Loading