mirror of
				https://gitlab.crans.org/bde/nk20
				synced 2025-10-31 07:49:57 +01:00 
			
		
		
		
	Serve static files with Nginx only in production to make JavaScript development easier
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
		| @@ -1,6 +0,0 @@ | |||||||
| --- |  | ||||||
| note: |  | ||||||
|   server_name: note-beta.crans.org |  | ||||||
|   git_branch: beta |  | ||||||
|   cron_enabled: false |  | ||||||
|   email: notekfet2020@lists.crans.org |  | ||||||
| @@ -2,5 +2,6 @@ | |||||||
| note: | note: | ||||||
|   server_name: note-dev.crans.org |   server_name: note-dev.crans.org | ||||||
|   git_branch: beta |   git_branch: beta | ||||||
|  |   serve_static: false | ||||||
|   cron_enabled: false |   cron_enabled: false | ||||||
|   email: notekfet2020@lists.crans.org |   email: notekfet2020@lists.crans.org | ||||||
|   | |||||||
| @@ -2,5 +2,6 @@ | |||||||
| note: | note: | ||||||
|   server_name: note.crans.org |   server_name: note.crans.org | ||||||
|   git_branch: master |   git_branch: master | ||||||
|  |   serve_static: true | ||||||
|   cron_enabled: true |   cron_enabled: true | ||||||
|   email: notekfet2020@lists.crans.org |   email: notekfet2020@lists.crans.org | ||||||
|   | |||||||
| @@ -1,6 +1,5 @@ | |||||||
| [dev] | [dev] | ||||||
| bde-note-dev.adh.crans.org | bde-note-dev.adh.crans.org | ||||||
| bde-nk20-beta.adh.crans.org |  | ||||||
|  |  | ||||||
| [prod] | [prod] | ||||||
| bde-note.adh.crans.org | bde-note.adh.crans.org | ||||||
|   | |||||||
| @@ -41,6 +41,7 @@ server { | |||||||
|     # max upload size |     # max upload size | ||||||
|     client_max_body_size 75M;   # adjust to taste |     client_max_body_size 75M;   # adjust to taste | ||||||
|  |  | ||||||
|  | {% if note.serve_static %} | ||||||
|     # Django media |     # Django media | ||||||
|     location /media  { |     location /media  { | ||||||
|         alias /var/www/note_kfet/media;  # your Django project's media files - amend as required |         alias /var/www/note_kfet/media;  # your Django project's media files - amend as required | ||||||
| @@ -50,6 +51,7 @@ server { | |||||||
|         alias /var/www/note_kfet/static; # your Django project's static files - amend as required |         alias /var/www/note_kfet/static; # your Django project's static files - amend as required | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | {% endif %} | ||||||
|     location /doc { |     location /doc { | ||||||
|         alias /var/www/documentation;    # The documentation of the project |         alias /var/www/documentation;    # The documentation of the project | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -35,8 +35,9 @@ urlpatterns = [ | |||||||
|     path('coffee/', include('django_htcpcp_tea.urls')), |     path('coffee/', include('django_htcpcp_tea.urls')), | ||||||
| ] | ] | ||||||
|  |  | ||||||
| # During development, serve media files | # During development, serve static and media files | ||||||
| if settings.DEBUG: | if settings.DEBUG: | ||||||
|  |     urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) | ||||||
|     urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) |     urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) | ||||||
|  |  | ||||||
| if "oauth2_provider" in settings.INSTALLED_APPS: | if "oauth2_provider" in settings.INSTALLED_APPS: | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user