This is a follow along project from DjangoCon 21 with Dane Hillard.
I have been exploring GraphQL as the most viable framework for a complex relational memory structure. This type of memory structure would have (k) applications in real world data management and graphQL's easy endpoint is super enticing. This is a minimal example of a graph implementation.
I did modify the project as shared by Dane using some of my own best-practices. I used `python-dotenv` for storing secrets and also added an authentication layer in the query using the `info.context.user.is_authenticated` from `info` given to the query.
A few of these came through with other packages. The important packages to reference here are:
python-dotenv
, psycopg2-binary
and graphene-django
- aniso8601==9.0.1
- asgiref==3.6.0
- Django==4.2
- graphene==3.2.2
- graphene-django==3.0.0
- graphql-core==3.2.3
- graphql-relay==3.2.0
- promise==2.3
- psycopg2-binary==2.9.6
- python-dotenv==1.0.0
- six==1.16.0
- sqlparse==0.4.4
- text-unidecode==1.3
- tzdata==2023.3
from pathlib import Path
from dotenv import load_dotenv
import os
load_dotenv()
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': os.environ.get('DB_NAME'),
'USER': os.environ.get('DB_USER'),
'PASSWORD': os.environ.get('DB_PASSWORD'),
'HOST': os.environ.get('DB_HOST'),
'PORT': '',
}
}
I use Postgres for most projects.
STATIC_URL = "/static/"
# Set the STATIC_ROOT setting to a valid filesystem path where Django can collect static files
STATIC_ROOT = os.path.join(BASE_DIR, 'collected_static')
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'static/media')
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static')
]
GRAPHENE = {
"SCHEMA": "schema.schema",
}