diff --git a/Dockerfile b/Dockerfile index 9ff75dc..55e5946 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ FROM tiangolo/uwsgi-nginx-flask:python3.8-alpine -COPY requirements.txt /app -RUN pip3 install -U pip -RUN pip3 install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/ +COPY requirements.txt /tmp COPY ./app/ /app/ +RUN pip3 install -U pip -i https://mirrors.aliyun.com/pypi/simple/ +RUN pip3 install -r /tmp/requirements.txt -i https://mirrors.aliyun.com/pypi/simple/ diff --git a/app/Article.py b/app/Article.py index 4b7632f..b24e448 100644 --- a/app/Article.py +++ b/app/Article.py @@ -11,7 +11,7 @@ from difficulty import get_difficulty_level_for_user, text_difficulty_level, use path_prefix = '/var/www/wordfreq/wordfreq/' -path_prefix = './' # comment this line in deployment +path_prefix = './db/' # comment this line in deployment def total_number_of_essays(): diff --git a/app/model/__init__.py b/app/model/__init__.py index a360d0c..f5256a2 100644 --- a/app/model/__init__.py +++ b/app/model/__init__.py @@ -1,7 +1,7 @@ from pony.orm import * db = Database() -db.bind("sqlite", "../wordfreqapp.db", create_db=True) # bind sqlite file +db.bind("sqlite", "../db/wordfreqapp.db", create_db=True) # bind sqlite file class User(db.Entity): diff --git a/app/templates/login.html b/app/templates/login.html index 81f7e0e..794be80 100644 --- a/app/templates/login.html +++ b/app/templates/login.html @@ -39,7 +39,6 @@ 注册 - {% endif %} diff --git a/app/templates/mainpage_get.html b/app/templates/mainpage_get.html index 344943d..e96e8dc 100644 --- a/app/templates/mainpage_get.html +++ b/app/templates/mainpage_get.html @@ -44,6 +44,7 @@ {{x[0]}} {{x[1]}} {% endfor %} {% endif %} +
Version: 20230810
{{ yml['footer'] | safe }} diff --git a/build.sh b/build.sh index c86c07b..158a86f 100755 --- a/build.sh +++ b/build.sh @@ -3,9 +3,6 @@ DEPLOYMENT_DIR=/home/lanhui/englishpal2/EnglishPal cd $DEPLOYMENT_DIR pwd -# Install dependencies - -#pip3 install -r requirements.txt # Stop service sudo docker stop EnglishPal @@ -15,7 +12,7 @@ sudo docker rm EnglishPal sudo docker build -t englishpal . # Run the application -sudo docker run --restart=always -d --name EnglishPal -p 90:80 -v ${DEPLOYMENT_DIR}/app/static/frequency:/app/static/frequency --mount type=volume,src=englishpal-db,target=/app -t englishpal # for permanently saving data +sudo docker run --restart=always -d --name EnglishPal -p 90:80 -v ${DEPLOYMENT_DIR}/app/static/frequency:/app/static/frequency --mount type=volume,src=englishpal-db,target=/app/db -t englishpal # for permanently saving data # Save space. Run it after sudo docker run sudo docker system prune -a -f