Я развертываю приложение на локальном хосте и прослушиваю порт на удаленном сервере, который привязан к домену, приложение отлично отображается на локальном хосте, а статическая папка не передается на сервер, как я могу решить эту проблему?
server {
server_name example.com;
listen 80;
root /var/www/html/;
location /somestatics {
root /var/simage/myimages/;
add_header 'Access-Control-Allow-Origin' '*';
}
location /otherresource/ {
add_header 'Access-Control-Allow-Origin' '*';
proxy_pass http://localhost:1080/iipsrv/iipsrv.fcgi?iiif=/testapi/;}
#another application
location /uv/{
proxy_pass http://localhost:8085/;
}
# this is my flask app
location / {
include proxy_params;
proxy_pass http://unix:/var/www/html/flaskapp/flaskapp.sock;
}
}
docker-compose.yml:
version: "3.7"
services:
web:
build:
context: ./app
dockerfile: Dockerfile
restart: always
ports:
- "5000:5000"
nginx:
build:
context: ./nginx
dockerfile: Dockerfile
restart: always
ports:
- "3002:3002"
app.py:
from flask import Flask, render_template, request, redirect, url_for, send_from_directory
from flask_babel import Babel
# from flask.helpers import safe_join
import os
# from flask_babel import lazy_gettext as _l
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
from config import Config
from db_driver import DBDriver
db = SQLAlchemy()
migrate = Migrate()
# static = safe_join(os.path.dirname(__file__), 'static')
def create_app():
app = Flask(__name__)
# collect = Collect()
app.config.from_object(Config)
db.init_app(app)
migrate.init_app(app, db)
return app
app = create_app()
babel = Babel(app)
@babel.localeselector
def get_locale():
return request.accept_languages.best_match(app.config["LANGUAGES"])
# return 'uk'
@app.errorhandler(404)
def not_found_error(error):
return {"message": "Упс, помилочка 404!"}, 404
@app.route("/")
def index():
staff_list = DBDriver.get_staff_list()
return render_template("about.html", staff_list=staff_list)
if __name__ == "__main__":
app.run(debug=True, host="0.0.0.0")