1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-12-25 15:45:23 +00:00

add collect static command for rest/swagger ui

This commit is contained in:
catborise 2022-08-24 10:29:29 +03:00
parent 234638a85c
commit 46514d0897
6 changed files with 16 additions and 7 deletions

View file

@ -1,8 +1,8 @@
language: python language: python
python: python:
- "3.6" - "3.9"
env: env:
- DJANGO=3.2.4 - DJANGO=3.2.15
install: install:
- pip install -r dev/requirements.txt - pip install -r dev/requirements.txt
script: script:

View file

@ -41,6 +41,7 @@ RUN python3 -m venv venv && \
RUN . venv/bin/activate && \ RUN . venv/bin/activate && \
python3 manage.py migrate && \ python3 manage.py migrate && \
python3 manage.py collectstatic --noinput && \
chown -R www-data:www-data /srv/webvirtcloud chown -R www-data:www-data /srv/webvirtcloud
# Setup Nginx # Setup Nginx

View file

@ -72,6 +72,7 @@ virtualenv -p python3 venv
source venv/bin/activate source venv/bin/activate
pip install -r conf/requirements.txt pip install -r conf/requirements.txt
python3 manage.py migrate python3 manage.py migrate
python3 manage.py collectstatic --noinput
sudo chown -R www-data:www-data /srv/webvirtcloud sudo chown -R www-data:www-data /srv/webvirtcloud
sudo rm /etc/nginx/sites-enabled/default sudo rm /etc/nginx/sites-enabled/default
``` ```
@ -119,6 +120,7 @@ source venv/bin/activate
pip3 install -r conf/requirements.txt pip3 install -r conf/requirements.txt
cp conf/nginx/webvirtcloud.conf /etc/nginx/conf.d/ cp conf/nginx/webvirtcloud.conf /etc/nginx/conf.d/
python3 manage.py migrate python3 manage.py migrate
python3 manage.py collectstatic --noinput
``` ```
#### Configure the supervisor for CentOS #### Configure the supervisor for CentOS
@ -357,6 +359,7 @@ source venv/bin/activate
git pull git pull
pip3 install -U -r conf/requirements.txt pip3 install -U -r conf/requirements.txt
python3 manage.py migrate python3 manage.py migrate
python3 manage.py collectstatic --noinput
sudo service supervisor restart sudo service supervisor restart
``` ```

2
Vagrantfile vendored
View file

@ -42,7 +42,9 @@ Vagrant.configure(2) do |config|
sudo cp /srv/webvirtcloud/conf/nginx/webvirtcloud.conf /etc/nginx/conf.d sudo cp /srv/webvirtcloud/conf/nginx/webvirtcloud.conf /etc/nginx/conf.d
sudo cp /srv/webvirtcloud/webvirtcloud/settings.py.template /srv/webvirtcloud/webvirtcloud/settings.py sudo cp /srv/webvirtcloud/webvirtcloud/settings.py.template /srv/webvirtcloud/webvirtcloud/settings.py
sudo sed "s/SECRET_KEY = ''/SECRET_KEY = '"`python3 /srv/webvirtcloud/conf/runit/secret_generator.py`"'/" -i /srv/webvirtcloud/webvirtcloud/settings.py sudo sed "s/SECRET_KEY = ''/SECRET_KEY = '"`python3 /srv/webvirtcloud/conf/runit/secret_generator.py`"'/" -i /srv/webvirtcloud/webvirtcloud/settings.py
python3 /srv/webvirtcloud/manage.py makemigrations
python3 /srv/webvirtcloud/manage.py migrate python3 /srv/webvirtcloud/manage.py migrate
python3 /srv/webvirtcloud/manage.py collectstatic --noinput
sudo rm /etc/nginx/sites-enabled/default sudo rm /etc/nginx/sites-enabled/default
sudo chown -R www-data:www-data /srv/webvirtcloud sudo chown -R www-data:www-data /srv/webvirtcloud
sudo service nginx restart sudo service nginx restart

View file

@ -260,8 +260,13 @@ install_webvirtcloud () {
echo "* Django Migrate." echo "* Django Migrate."
log "$PYTHON $APP_PATH/manage.py migrate" log "$PYTHON $APP_PATH/manage.py migrate"
$PYTHON $APP_PATH/manage.py migrate
$PYTHON $APP_PATH/manage.py makemigrations $PYTHON $APP_PATH/manage.py makemigrations
$PYTHON $APP_PATH/manage.py migrate
echo "* Django Collect Static"
log "$PYTHON $APP_PATH/manage.py collectstatic --noinput"
$PYTHON $APP_PATH/manage.py collectstatic --noinput
chown -R "$nginx_group":"$nginx_group" "$APP_PATH" chown -R "$nginx_group":"$nginx_group" "$APP_PATH"
} }

View file

@ -132,9 +132,7 @@ USE_TZ = True
STATIC_URL = "/static/" STATIC_URL = "/static/"
STATICFILES_DIRS = [ STATIC_ROOT = Path.joinpath(BASE_DIR, "static")
Path.joinpath(BASE_DIR, "static"),
]
# Default primary key field type # Default primary key field type