Skip to content

Commit

Permalink
deploy.bat for windows (fixes #20)
Browse files Browse the repository at this point in the history
  • Loading branch information
sheppard committed Feb 16, 2022
1 parent 3dcba94 commit bd2bfca
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 49 deletions.
7 changes: 4 additions & 3 deletions db/project_name/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
'wq.db.rest',
'wq.db.rest.auth',{% if not with_npm %}
'wq.app',{% endif %}
'wq.build',

# Project apps
'{{ project_name }}_survey',
Expand Down Expand Up @@ -137,10 +138,10 @@
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.2/howto/static-files/

STATIC_URL = '/static/'{% if not with_npm %}
STATIC_URL = '/static/'
STATICFILES_DIRS = [
('app', BASE_DIR / 'app'),
]{% endif %}
{% if with_npm %}BASE_DIR / 'app' / 'build' / 'static'{% else %}('app', BASE_DIR / 'app'){% endif %},
]

# wq: Configure paths for default project layout
PROJECT_NAME = '{{ title }}'
Expand Down
1 change: 1 addition & 0 deletions deploy.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python db/manage.py deploy %1
33 changes: 1 addition & 32 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -1,35 +1,4 @@
#!/bin/sh

# Exit on error
set -e

VERSION=$1;

if [ -z "$VERSION" ]; then
echo "Usage: ./deploy.sh [VERSION]"
exit 1
fi;

# Regenerate JSON fixtures
./update_json.sh $VERSION;

wq icons;
{% if with_npm %}
# Build using react-scripts (Webpack/Babel)
cd app;
npm run build;

# Update existing htdocs with new version
cd ..;
mkdir -p htdocs/
cp -a app/build/* htdocs/
{% else %}
# Collect static app files
wq build $VERSION
db/manage.py collectstatic --no-input
mv htdocs/static/app/public/*.* htdocs/
wq serviceworker $VERSION
{% endif %}

# Restart Django
db/manage.py deploy $1
touch db/{{project_name}}/wsgi.py
13 changes: 0 additions & 13 deletions update_json.sh

This file was deleted.

13 changes: 12 additions & 1 deletion wq.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,23 @@ setversion:
package: app/package.json{% else %}
esm: app/js/data/version.js{% endif %}

# Generate config.js
dump_config:
format: esm
filename: app/{% if with_npm %}src{% else %}js{% endif %}/data/config.js

# Generate web icons
icons:
source: app/public/icon-1024.png
filename: app/public/icon-{size}.png
size: web
{% if not with_npm %}# Generate Service Worker

# Move public files to root
movefiles:
source: {% if with_npm %}app/build{% else %}htdocs/static/app/public{% endif %}/*.*
dest: htdocs/
{% if not with_npm %}
# Generate Service Worker
serviceworker:
output: ./htdocs/service-worker.js
timeout: 400
Expand Down

0 comments on commit bd2bfca

Please sign in to comment.