0

I'm currently working on getting the javascript project SVGnest to work locally. My optimal solution would be to execute the program via python commands or through an python port. However, I did not find any solution for that.

As a first step, I want to run a flask server now and host the application locally. For that, I've cloned the project and created the following server.py

#!/usr/bin/env python

import flask


# Create the application.
APP = flask.Flask(__name__, template_folder=".", static_folder=".")


@APP.route('/')
def index():
    """ Displays the index page accessible at '/'
    """
    return flask.render_template('index.html')


if __name__ == '__main__':
    APP.debug=True
    APP.run()

The server starts at localhost, however, a lot of files cannot be loaded:

127.0.0.1 - - [27/Jan/2022 13:22:17] "GET /font/latolatinfonts.css HTTP/1.1" 404 -
127.0.0.1 - - [27/Jan/2022 13:22:17] "GET /style.css HTTP/1.1" 404 -
127.0.0.1 - - [27/Jan/2022 13:22:17] "GET /util/pathsegpolyfill.js HTTP/1.1" 404 -
127.0.0.1 - - [27/Jan/2022 13:22:17] "GET /util/domparser.js HTTP/1.1" 404 -
127.0.0.1 - - [27/Jan/2022 13:22:17] "GET /util/matrix.js HTTP/1.1" 404 -
127.0.0.1 - - [27/Jan/2022 13:22:17] "GET /util/clipper.js HTTP/1.1" 404 -
127.0.0.1 - - [27/Jan/2022 13:22:17] "GET /util/parallel.js HTTP/1.1" 404 -
....

Seems like the server does not find the files, although they are in the same directory as the index.html. My directories are

  • SVGNest
    • font/
    • img/
    • util/
    • index.html
    • server.py
    • style.css
    • svgnest.js -svgparser.js

Thanks for helping

mc1893
  • 133
  • 5
  • 1
    This should help you; https://stackoverflow.com/questions/20646822/how-to-serve-static-files-in-flask – Sy Ker Jan 27 '22 at 12:42

0 Answers0