Skip to content

Commit 533783a

Browse files
committed
2 parents aa27b80 + 8cb218a commit 533783a

27 files changed

+3886
-102
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Discussions were held about the vision of the blog (before deciding to make this
1111

1212
## Designs
1313

14-
Check the initial prototype preview [here](https://www.figma.com/proto/lDqugnE4ifN0X521f3KMER/Clinify-Blog?page-id=0%3A1&node-id=45%3A16&viewport=715%2C219%2C0.4623492956161499&scaling=scale-down-width)
14+
Check the initial prototype preview [here](https://www.figma.com/proto/SXImQuBg7e6Cp0cwQsDhdu/Blog?node-id=1%3A104&scaling=scale-down-width&page-id=0%3A1)
1515

1616
## Frontend
1717

chacha_backend/.gitignore

+124
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# Django #
2+
*.log
3+
*.pot
4+
*.pyc
5+
__pycache__
6+
db.sqlite3
7+
media
8+
9+
# Backup files #
10+
*.bak
11+
12+
# If you are using PyCharm #
13+
.idea/**/workspace.xml
14+
.idea/**/tasks.xml
15+
.idea/dictionaries
16+
.idea/**/dataSources/
17+
.idea/**/dataSources.ids
18+
.idea/**/dataSources.xml
19+
.idea/**/dataSources.local.xml
20+
.idea/**/sqlDataSources.xml
21+
.idea/**/dynamic.xml
22+
.idea/**/uiDesigner.xml
23+
.idea/**/gradle.xml
24+
.idea/**/libraries
25+
*.iws /out/
26+
27+
# Python #
28+
*.py[cod]
29+
*$py.class
30+
31+
# Distribution / packaging
32+
.Python build/
33+
develop-eggs/
34+
dist/
35+
downloads/
36+
eggs/
37+
.eggs/
38+
lib/
39+
lib64/
40+
parts/
41+
sdist/
42+
var/
43+
wheels/
44+
*.egg-info/
45+
.installed.cfg
46+
*.egg
47+
*.manifest
48+
*.spec
49+
50+
# Installer logs
51+
pip-log.txt
52+
pip-delete-this-directory.txt
53+
54+
# Unit test / coverage reports
55+
htmlcov/
56+
.tox/
57+
.coverage
58+
.coverage.*
59+
.cache
60+
.pytest_cache/
61+
nosetests.xml
62+
coverage.xml
63+
*.cover
64+
.hypothesis/
65+
66+
# Jupyter Notebook
67+
.ipynb_checkpoints
68+
69+
# pyenv
70+
.python-version
71+
72+
# celery
73+
celerybeat-schedule.*
74+
75+
# SageMath parsed files
76+
*.sage.py
77+
78+
# Environments
79+
.env
80+
.venv
81+
env/
82+
venv/
83+
ENV/
84+
env.bak/
85+
venv.bak/
86+
87+
# mkdocs documentation
88+
/site
89+
90+
# mypy
91+
.mypy_cache/
92+
93+
# Sublime Text #
94+
*.tmlanguage.cache
95+
*.tmPreferences.cache
96+
*.stTheme.cache
97+
*.sublime-workspace
98+
*.sublime-project
99+
100+
# sftp configuration file
101+
sftp-config.json
102+
103+
# Package control specific files Package
104+
Control.last-run
105+
Control.ca-list
106+
Control.ca-bundle
107+
Control.system-ca-bundle
108+
GitHub.sublime-settings
109+
110+
# Visual Studio Code #
111+
.vscode/*
112+
!.vscode/settings.json
113+
!.vscode/tasks.json
114+
!.vscode/launch.json
115+
!.vscode/extensions.json
116+
.history
117+
118+
**/migrations
119+
*.DS_Store
120+
**/__pycache__
121+
**/.DS_Store
122+
123+
#packages-virtual venv
124+
**/packages

chacha_backend/core/__init__.py

Whitespace-only changes.

chacha_backend/core/asgi.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
ASGI config for core project.
3+
4+
It exposes the ASGI callable as a module-level variable named ``application``.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/
8+
"""
9+
10+
import os
11+
12+
from django.core.asgi import get_asgi_application
13+
14+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings')
15+
16+
application = get_asgi_application()

chacha_backend/core/settings.py

+166
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
"""
2+
Django settings for core project.
3+
4+
Generated by 'django-admin startproject' using Django 3.2.4.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/3.2/topics/settings/
8+
9+
For the full list of settings and their values, see
10+
https://docs.djangoproject.com/en/3.2/ref/settings/
11+
"""
12+
13+
from pathlib import Path
14+
import graphene_django
15+
16+
# Build paths inside the project like this: BASE_DIR / 'subdir'.
17+
BASE_DIR = Path(__file__).resolve().parent.parent
18+
19+
20+
# Quick-start development settings - unsuitable for production
21+
# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
22+
23+
# SECURITY WARNING: keep the secret key used in production secret!
24+
SECRET_KEY = 'django-insecure-w$!%w@p3gz-yrgbw=9*_8vsy1&6&y3j#=@co2dxr6zbkayww3q'
25+
26+
# SECURITY WARNING: don't run with debug turned on in production!
27+
DEBUG = True
28+
29+
ALLOWED_HOSTS = []
30+
31+
32+
# Application definition
33+
34+
INSTALLED_APPS = [
35+
'django.contrib.admin',
36+
'django.contrib.auth',
37+
'django.contrib.contenttypes',
38+
'django.contrib.sessions',
39+
'django.contrib.messages',
40+
'django.contrib.staticfiles',
41+
'users',
42+
'graphene_django',
43+
'graphql_jwt.refresh_token.apps.RefreshTokenConfig',
44+
'graphql_auth',
45+
'django_filters',
46+
47+
]
48+
49+
MIDDLEWARE = [
50+
'django.middleware.security.SecurityMiddleware',
51+
'django.contrib.sessions.middleware.SessionMiddleware',
52+
'django.middleware.common.CommonMiddleware',
53+
'django.middleware.csrf.CsrfViewMiddleware',
54+
'django.contrib.auth.middleware.AuthenticationMiddleware',
55+
'django.contrib.messages.middleware.MessageMiddleware',
56+
'django.middleware.clickjacking.XFrameOptionsMiddleware',
57+
]
58+
59+
ROOT_URLCONF = 'core.urls'
60+
61+
TEMPLATES = [
62+
{
63+
'BACKEND': 'django.template.backends.django.DjangoTemplates',
64+
'DIRS': [],
65+
'APP_DIRS': True,
66+
'OPTIONS': {
67+
'context_processors': [
68+
'django.template.context_processors.debug',
69+
'django.template.context_processors.request',
70+
'django.contrib.auth.context_processors.auth',
71+
'django.contrib.messages.context_processors.messages',
72+
],
73+
},
74+
},
75+
]
76+
77+
WSGI_APPLICATION = 'core.wsgi.application'
78+
79+
80+
# Database
81+
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
82+
83+
DATABASES = {
84+
'default': {
85+
'ENGINE': 'django.db.backends.sqlite3',
86+
'NAME': BASE_DIR / 'db.sqlite3',
87+
}
88+
}
89+
90+
91+
# Password validation
92+
# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
93+
94+
AUTH_PASSWORD_VALIDATORS = [
95+
{
96+
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
97+
},
98+
{
99+
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
100+
},
101+
{
102+
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
103+
},
104+
{
105+
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
106+
},
107+
]
108+
109+
110+
# Internationalization
111+
# https://docs.djangoproject.com/en/3.2/topics/i18n/
112+
113+
LANGUAGE_CODE = 'en-us'
114+
115+
TIME_ZONE = 'UTC'
116+
117+
USE_I18N = True
118+
119+
USE_L10N = True
120+
121+
USE_TZ = True
122+
123+
124+
# Static files (CSS, JavaScript, Images)
125+
# https://docs.djangoproject.com/en/3.2/howto/static-files/
126+
127+
STATIC_URL = '/static/'
128+
129+
AUTH_USER_MODEL = 'users.ExtendUser'
130+
131+
GRAPHENE = {
132+
'SCHEMA': 'users.schema.schema',
133+
'MIDDLEWARE': [
134+
'graphql_jwt.middleware.JSONWebTokenMiddleware',
135+
],
136+
137+
}
138+
139+
140+
AUTHENTICATION_BACKENDS = [
141+
##'graphql_jwt.backends.JSONWebTokenBackend',
142+
'graphql_auth.backends.GraphQLAuthBackend',
143+
'django.contrib.auth.backends.ModelBackend',
144+
]
145+
146+
GRAPHQL_JWT = {
147+
"JWT_ALLOW_ANY_CLASSES": [
148+
"graphql_auth.mutations.Register",
149+
"graphql_auth.mutations.VerifyAccount",
150+
"graphql_auth.mutations.ObtainJSOWebToken",
151+
],
152+
"JWT_VERIFY_EXPIRATION": True,
153+
"JWT_LONG_RUNNING_REFRESH_TOKEN": True,
154+
155+
}
156+
157+
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' # for now not integreating with the other service
158+
159+
160+
# Default primary key field type
161+
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
162+
163+
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
164+
165+
166+

chacha_backend/core/urls.py

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
"""core URL Configuration
2+
3+
The `urlpatterns` list routes URLs to views. For more information please see:
4+
https://docs.djangoproject.com/en/3.2/topics/http/urls/
5+
Examples:
6+
Function views
7+
1. Add an import: from my_app import views
8+
2. Add a URL to urlpatterns: path('', views.home, name='home')
9+
Class-based views
10+
1. Add an import: from other_app.views import Home
11+
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
12+
Including another URLconf
13+
1. Import the include() function: from django.urls import include, path
14+
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
15+
"""
16+
from django.contrib import admin
17+
from django.urls import path
18+
from django.views.decorators.csrf import csrf_exempt
19+
20+
from graphene_django.views import GraphQLView
21+
import graphql
22+
23+
urlpatterns = [
24+
path('admin/', admin.site.urls),
25+
path("graphql", csrf_exempt(GraphQLView.as_view(graphiql=True))),
26+
]

chacha_backend/core/wsgi.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
WSGI config for core project.
3+
4+
It exposes the WSGI callable as a module-level variable named ``application``.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/
8+
"""
9+
10+
import os
11+
12+
from django.core.wsgi import get_wsgi_application
13+
14+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings')
15+
16+
application = get_wsgi_application()

chacha_backend/manage.py

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env python
2+
"""Django's command-line utility for administrative tasks."""
3+
import os
4+
import sys
5+
6+
7+
def main():
8+
"""Run administrative tasks."""
9+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings')
10+
try:
11+
from django.core.management import execute_from_command_line
12+
except ImportError as exc:
13+
raise ImportError(
14+
"Couldn't import Django. Are you sure it's installed and "
15+
"available on your PYTHONPATH environment variable? Did you "
16+
"forget to activate a virtual environment?"
17+
) from exc
18+
execute_from_command_line(sys.argv)
19+
20+
21+
if __name__ == '__main__':
22+
main()

0 commit comments

Comments
 (0)