Skip to content

Commit

Permalink
Remove static/ directory and update frontend deployment docs (#718)
Browse files Browse the repository at this point in the history
Followup on commit 2991254 which removed the management commands
necessary for serving the frontend via Django. The supported workflow
is now to deploy the frontend separately and configure it to talk
to this Django app. If desired, both can be served by an Nginx proxy
(which serves static files for the frontend and proxies /api requests
to Django).
  • Loading branch information
jake-low authored Oct 1, 2024
1 parent cba2872 commit 329df5f
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 37 deletions.
12 changes: 4 additions & 8 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,10 @@ How to login using the OAuth api
Frontend
^^^^^^^^

`osmcha-frontend <https://github.com/osmcha/osmcha-frontend>`_ is a web interface
that you can use to interact with the API. We have a django management command
to get the last version of osmcha-frontend and serve it with the API.

$ python manage.py update_frontend

After that, if you have set all the environment variables properly, you can start
the server and have the frontend in your root url.
`osmcha-frontend <https://github.com/osmcha/osmcha-frontend>`_ is a web
interface that you can use to interact with the API. The web interface can be
deployed separately and configured to talk to this Django app when making API
requests. See the README in that repository for more details.

Feature creation endpoint
^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
37 changes: 18 additions & 19 deletions config/settings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

# APP CONFIGURATION
# ------------------------------------------------------------------------------
DJANGO_APPS = (
DJANGO_APPS = [
# Default Django apps:
'django.contrib.auth',
'django.contrib.contenttypes',
Expand All @@ -49,24 +49,25 @@

# Admin
'django.contrib.admin',
)
THIRD_PARTY_APPS = (
]

THIRD_PARTY_APPS = [
'rest_framework',
'rest_framework_gis',
'rest_framework.authtoken',
'social_django',
'corsheaders',
'django_filters',
'drf_yasg',
)
]

# Apps specific for this project go here.
LOCAL_APPS = (
LOCAL_APPS = [
'osmchadjango.users', # custom users app
'osmchadjango.changeset',
'osmchadjango.supervise',
'osmchadjango.roulette_integration',
)
]

# See: https://docs.djangoproject.com/en/dev/ref/settings/#installed-apps
INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS
Expand Down Expand Up @@ -100,9 +101,9 @@
# FIXTURE CONFIGURATION
# ------------------------------------------------------------------------------
# See: https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-FIXTURE_DIRS
FIXTURE_DIRS = (
FIXTURE_DIRS = [
str(APPS_DIR.path('fixtures')),
)
]

# EMAIL CONFIGURATION
# ------------------------------------------------------------------------------
Expand All @@ -111,9 +112,9 @@
# MANAGER CONFIGURATION
# ------------------------------------------------------------------------------
# See: https://docs.djangoproject.com/en/dev/ref/settings/#admins
ADMINS = (
ADMINS = [
('name', '[email protected]'),
)
]

# See: https://docs.djangoproject.com/en/dev/ref/settings/#managers
MANAGERS = ADMINS
Expand Down Expand Up @@ -209,15 +210,13 @@
STATIC_URL = '/static/'

# See: https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#std:setting-STATICFILES_DIRS
STATICFILES_DIRS = (
str(APPS_DIR.path('static')),
)
STATICFILES_DIRS = []

# See: https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#staticfiles-finders
STATICFILES_FINDERS = (
STATICFILES_FINDERS = [
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)
]

# MEDIA CONFIGURATION
# ------------------------------------------------------------------------------
Expand Down Expand Up @@ -257,12 +256,12 @@

# AUTHENTICATION CONFIGURATION
# ------------------------------------------------------------------------------
AUTHENTICATION_BACKENDS = (
AUTHENTICATION_BACKENDS = [
"social_core.backends.openstreetmap_oauth2.OpenStreetMapOAuth2",
"django.contrib.auth.backends.ModelBackend",
)
]

SOCIAL_AUTH_PIPELINE = (
SOCIAL_AUTH_PIPELINE = [
'social_core.pipeline.social_auth.social_details',
'social_core.pipeline.social_auth.social_uid',
'social_core.pipeline.social_auth.auth_allowed',
Expand All @@ -274,7 +273,7 @@
'social_core.pipeline.social_auth.load_extra_data',
'social_core.pipeline.user.user_details'
# 'social_core.pipeline.social_auth.associate_by_email',
)
]

# LOGGING CONFIGURATION
# ------------------------------------------------------------------------------
Expand Down
Empty file removed osmchadjango/static/css/.gitkeep
Empty file.
8 changes: 0 additions & 8 deletions osmchadjango/static/css/main.6bb33d35.css

This file was deleted.

Empty file removed osmchadjango/static/fonts/.gitkeep
Empty file.
Empty file.
Binary file removed osmchadjango/static/images/favicon.ico
Binary file not shown.
Binary file removed osmchadjango/static/images/osm_logo.png
Binary file not shown.
Empty file removed osmchadjango/static/js/.gitkeep
Empty file.
2 changes: 0 additions & 2 deletions osmchadjango/static/js/main.1cb188b8.js

This file was deleted.

Empty file removed osmchadjango/static/media/.gitkeep
Empty file.

0 comments on commit 329df5f

Please sign in to comment.