File tree Expand file tree Collapse file tree 2 files changed +27
-10
lines changed
Expand file tree Collapse file tree 2 files changed +27
-10
lines changed Original file line number Diff line number Diff line change 1- .PHONY : deploy deploy-staging sync-on-prod fetch-nginx-config
1+ .PHONY : deploy deploy-staging sync-on-prod fetch-nginx-config clipping-service
22
33GIT_DIR := /opt/ckan-catalog/data.naturalcapitalproject.stanford.edu
44CKAN_PROD_URL := https://data.naturalcapitalproject.stanford.edu
@@ -24,3 +24,18 @@ fetch-nginx-config:
2424 gcloud compute scp $(GCLOUD_COMMON_ARGS ) $(PROD_VM_NAME ) :/etc/nginx/sites-enabled/ckan host-nginx/etc.nginx.sites-available.ckan
2525 gcloud compute scp $(GCLOUD_COMMON_ARGS ) $(PROD_VM_NAME ) :/etc/nginx/nginx.conf host-nginx/etc.nginx.nginx.conf
2626 gcloud compute scp $(GCLOUD_COMMON_ARGS ) $(PROD_VM_NAME ) :/etc/nginx/throttle-bots.conf host-nginx/etc.nginx.throttle-bots.conf
27+
28+
29+ # Targets for local development:
30+ CLIP_ENV := clipenv
31+
32+ env-clip :
33+ conda create -n $(CLIP_ENV ) -y -c conda-forge python=3.12
34+ conda env update -n $(CLIP_ENV ) --file ./clipping-service/app/requirements.txt
35+ conda env config vars set -n $(CLIP_ENV ) DEV_MODE=True
36+ @echo " To activate the environment and run the clipping service:"
37+ @echo " >> conda activate $( CLIP_ENV) "
38+ @echo " >> make clipping-service"
39+
40+ clipping-service :
41+ python -m gunicorn --chdir ./clipping-service/app app:app --reload
Original file line number Diff line number Diff line change 2424from osgeo import osr
2525
2626app = flask .Flask (__name__ , template_folder = 'templates' )
27+
28+ cors_origins = [
29+ 'https://data-staging.naturalcapitalproject.org' ,
30+ 'https://data.naturalcapitalproject.stanford.edu'
31+ ]
32+
33+ if os .environ .get ("DEV_MODE" ):
34+ cors_origins .append ("https://localhost:*" )
35+
2736CORS (app , resources = {
2837 '/*' : {
29- 'origins' : [
30- # Only use localhost for local development.
31- # 'http://localhost:*',
32- # 'https://localhost:*',
33- # 'http://127.0.0.1:*',
34- 'https://data-staging.naturalcapitalproject.org' ,
35- 'https://data.naturalcapitalproject.stanford.edu' ,
36- ]
38+ 'origins' : cors_origins
3739 }
3840})
39- logging .basicConfig (level = logging .DEBUG )
4041
42+ logging .basicConfig (level = logging .DEBUG )
4143
4244# PLAN: write a logging handler to listen for progress messages and send those
4345# to the client.
You can’t perform that action at this time.
0 commit comments