Skip to content
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,6 @@ venv.bak/

# vscode configs
.vscode

# secrets
projectsplatform/secrets.py
30 changes: 30 additions & 0 deletions projectsplatform/secrets.example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# SECURITY WARNING: don't run with debug turned on in production!
SECRET_KEY = ''

# Database
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': '',
'USER': '',
'PASSWORD': '',
'HOST': 'localhost',
'PORT': '5432',
}
}


# Provider specific settings
SITE_ID = 2
SOCIALACCOUNT_PROVIDERS = {
'github': {
# todo: do not commit this to github
'APP': {
'client_id': '',
'secret': '',
'key': ''
}
}
}
48 changes: 31 additions & 17 deletions projectsplatform/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"""

import os
from .secrets import *

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
Expand All @@ -20,8 +21,6 @@
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/


# SECURITY WARNING: don't run with debug turned on in production!
SECRET_KEY = 'dulwepf_b#@eh19w)==v+pxvw$u$2gbxpwoevmzg)h-pl1mded'
DEBUG = True

ALLOWED_HOSTS = []
Expand All @@ -36,8 +35,23 @@
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'corsheaders',
'django.contrib.sites',
'scprojects.apps.ScprojectsConfig',
'allauth',
'allauth.account',
'allauth.socialaccount',
'allauth.socialaccount.providers.github',

]

CORS_ALLOW_CREDENTIALS = True

CORS_ORIGIN_WHITELIST = [
"http://localhost:3000",
]
SESSION_COOKIE_SAMESITE = None
CRSF_COOKIE_SAMESITE = None
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
Expand All @@ -46,6 +60,8 @@
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
]

ROOT_URLCONF = 'projectsplatform.urls'
Expand All @@ -61,6 +77,8 @@
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
# `allauth` needs this from django
'django.template.context_processors.request',
],
},
},
Expand All @@ -69,21 +87,6 @@
WSGI_APPLICATION = 'projectsplatform.wsgi.application'


# Database
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'scprojects',
'USER': 'scadmin',
'PASSWORD': '',
'HOST': 'localhost',
'PORT': '5432',
}
}


# Password validation
# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators

Expand Down Expand Up @@ -121,3 +124,14 @@
# https://docs.djangoproject.com/en/2.2/howto/static-files/

STATIC_URL = '/static/'

AUTHENTICATION_BACKENDS = (
# Needed to login by username in Django admin, regardless of `allauth`
'django.contrib.auth.backends.ModelBackend',

# `allauth` specific authentication methods, such as login by e-mail
'allauth.account.auth_backends.AuthenticationBackend',
)

ACCOUNT_EMAIL_CONFIRMATION_AUTHENTICATED_REDIRECT_URL = None
LOGIN_REDIRECT_URL = FRONTEND_DOMAIN_NAME
6 changes: 5 additions & 1 deletion projectsplatform/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from django.urls import include, path, re_path
from scprojects import views

urlpatterns = [
path('projects/', include('scprojects.urls')),
path('admin/', admin.site.urls),
path('', views.index, name='index'),
re_path(r'^accounts/', include('allauth.urls')),
]
Empty file added scprojects/__init__.py
Empty file.
7 changes: 7 additions & 0 deletions scprojects/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from django.contrib import admin

from .models import Project, UserProfile

admin.site.register(Project)
admin.site.register(UserProfile)
# Register your models here.
8 changes: 8 additions & 0 deletions scprojects/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from django.apps import AppConfig


class ScprojectsConfig(AppConfig):
name = 'scprojects'

def ready(self):
import scprojects.signals
41 changes: 41 additions & 0 deletions scprojects/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Generated by Django 2.2.6 on 2019-12-28 20:25

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

initial = True

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]

operations = [
migrations.CreateModel(
name='Tag',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', models.DateTimeField(auto_now_add=True)),
('updated', models.DateTimeField(auto_now=True)),
('name', models.CharField(max_length=255)),
],
),
migrations.CreateModel(
name='Project',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255)),
('github_url', models.URLField(blank=True, max_length=255)),
('description', models.TextField()),
('looking_for', models.TextField()),
('created', models.DateTimeField(auto_now_add=True)),
('updated', models.DateTimeField(auto_now=True)),
('contributors', models.ManyToManyField(to=settings.AUTH_USER_MODEL)),
('lead', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='leads', to=settings.AUTH_USER_MODEL)),
('tech_stack', models.ManyToManyField(to='scprojects.Tag')),
],
),
]
20 changes: 20 additions & 0 deletions scprojects/migrations/0002_auto_20200113_1700.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Generated by Django 2.2.6 on 2020-01-13 17:00

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('scprojects', '0001_initial'),
]

operations = [
migrations.RemoveField(
model_name='project',
name='tech_stack',
),
migrations.DeleteModel(
name='Tag',
),
]
32 changes: 32 additions & 0 deletions scprojects/migrations/0003_userprofile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Generated by Django 2.2.6 on 2020-01-20 22:27

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('scprojects', '0002_auto_20200113_1700'),
]

operations = [
migrations.CreateModel(
name='UserProfile',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('department', models.CharField(max_length=100)),
('experience_lvl', models.PositiveSmallIntegerField()),
('position', models.CharField(max_length=255)),
('is_active', models.BooleanField()),
('github_username', models.CharField(max_length=255)),
('github_id', models.PositiveIntegerField()),
('github_url', models.URLField(blank=True, max_length=255)),
('avatar_url', models.URLField(blank=True, max_length=255)),
('gravatar_url', models.URLField(blank=True, max_length=255)),
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
]
28 changes: 28 additions & 0 deletions scprojects/migrations/0004_auto_20200123_0453.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Generated by Django 2.2.6 on 2020-01-23 04:53

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('scprojects', '0003_userprofile'),
]

operations = [
migrations.AlterField(
model_name='userprofile',
name='avatar_url',
field=models.URLField(max_length=255),
),
migrations.AlterField(
model_name='userprofile',
name='github_url',
field=models.URLField(max_length=255),
),
migrations.AlterField(
model_name='userprofile',
name='gravatar_url',
field=models.URLField(max_length=255),
),
]
17 changes: 17 additions & 0 deletions scprojects/migrations/0005_remove_userprofile_department.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 2.2.6 on 2020-01-23 06:58

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('scprojects', '0004_auto_20200123_0453'),
]

operations = [
migrations.RemoveField(
model_name='userprofile',
name='department',
),
]
19 changes: 19 additions & 0 deletions scprojects/migrations/0006_auto_20200123_0707.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 2.2.6 on 2020-01-23 07:07

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('scprojects', '0005_remove_userprofile_department'),
]

operations = [
migrations.AlterField(
model_name='project',
name='lead',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='leads', to='scprojects.UserProfile'),
),
]
20 changes: 20 additions & 0 deletions scprojects/migrations/0007_auto_20200123_0708.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Generated by Django 2.2.6 on 2020-01-23 07:08

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('scprojects', '0006_auto_20200123_0707'),
]

operations = [
migrations.AlterField(
model_name='project',
name='lead',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='leads', to=settings.AUTH_USER_MODEL),
),
]
19 changes: 19 additions & 0 deletions scprojects/migrations/0008_auto_20200123_0715.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 2.2.6 on 2020-01-23 07:15

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('scprojects', '0007_auto_20200123_0708'),
]

operations = [
migrations.AlterField(
model_name='project',
name='lead',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='leads', to='scprojects.UserProfile'),
),
]
17 changes: 17 additions & 0 deletions scprojects/migrations/0009_remove_project_contributors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 2.2.6 on 2020-01-23 07:22

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('scprojects', '0008_auto_20200123_0715'),
]

operations = [
migrations.RemoveField(
model_name='project',
name='contributors',
),
]
Loading