@@ -10,6 +10,7 @@ class Common(Configuration):
1010
1111 INSTALLED_APPS = (
1212 "django.contrib.admin" ,
13+ "django.contrib.gis" ,
1314 "django.contrib.auth" ,
1415 "django.contrib.contenttypes" ,
1516 "django.contrib.sessions" ,
@@ -18,15 +19,20 @@ class Common(Configuration):
1819 # Third party apps
1920 "rest_framework" , # utilities for rest apis
2021 "rest_framework.authtoken" , # token authentication
22+ "rest_framework_gis" ,
23+ "drf_spectacular" , # api-docs
2124 "django_filters" , # for filtering rest endpoints
25+ "corsheaders" ,
2226 # Your apps
2327 "vbos.users" ,
28+ "vbos.datasets" ,
2429 )
2530
2631 # https://docs.djangoproject.com/en/2.0/topics/http/middleware/
2732 MIDDLEWARE = (
2833 "django.middleware.security.SecurityMiddleware" ,
2934 "django.contrib.sessions.middleware.SessionMiddleware" ,
35+ "corsheaders.middleware.CorsMiddleware" ,
3036 "django.middleware.common.CommonMiddleware" ,
3137 "django.middleware.csrf.CsrfViewMiddleware" ,
3238 "django.contrib.auth.middleware.AuthenticationMiddleware" ,
@@ -47,7 +53,9 @@ class Common(Configuration):
4753 # Postgres
4854 DATABASES = {
4955 "default" : dj_database_url .config (
50- default = "postgis://postgres:@postgres:5432/vbos" ,
56+ default = os .getenv (
57+ "DJANGO_DB_URL" , "postgis://postgres:@postgres:5432/vbos"
58+ ),
5159 conn_max_age = int (os .getenv ("POSTGRES_CONN_MAX_AGE" , 600 )),
5260 )
5361 }
@@ -187,4 +195,12 @@ class Common(Configuration):
187195 "rest_framework.authentication.SessionAuthentication" ,
188196 "rest_framework.authentication.TokenAuthentication" ,
189197 ),
198+ "DEFAULT_SCHEMA_CLASS" : "drf_spectacular.openapi.AutoSchema" ,
199+ }
200+
201+ SPECTACULAR_SETTINGS = {
202+ "TITLE" : "VBOS-API" ,
203+ "DESCRIPTION" : "VBoS Management Information System API" ,
204+ "VERSION" : "1.0.0" ,
205+ "SERVE_INCLUDE_SCHEMA" : False ,
190206 }
0 commit comments