Server can't see the image. Pythonanywhere



  • I've asked a question, but now the problem is different. There's a Bottle project on Pythonanywhere. That's what the project says to the file.

    @route('/static/<filename>')
    def server_static(filename):
        return static_file(filename, root='static')
    

    Files stored /home/username/static/♪ CSS + JS server sees and works. Image doesn't see, it makes a mistake 404 It says: The URL /static/ should map to the folder /home/myusername/myproject/assetsOkay, I got a copy of all the files at the location, but no result. Here's wsgi.py.

    # This file contains the WSGI configuration required to serve up your
    # web application at http://<your-username>.pythonanywhere.com/
    # It works by setting the variable 'application' to a WSGI handler of some
    # description.
    #
    # The below has been auto-generated for your Bottle project
    import bottle
    import os
    import sys
    

    add your project directory to the sys.path

    project_home = u'/home/username/mysite'
    if project_home not in sys.path:
    sys.path = [project_home] + sys.path

    make sure the default templates directory is known to Bottle

    templates_dir = os.path.join(project_home, 'views/')
    if templates_dir not in bottle.TEMPLATE_PATH:
    bottle.TEMPLATE_PATH.insert(0, templates_dir)

    import bottle application

    from bottle_app import application

    All templates, skepts, styles work, and images don't.
    I've put a set of images in all the files, but it's like there's no place.
    I don't know what else to do. ♪
    Where's the mistake?



  • Pythonany's sappport just said... ♪ It's all about register dependency. Your file is expanded. .JPGThat's why you have to ask .JPGNot .jpgNow I've got why I see these pictures while I'm working with a test server on a homework with Winda, but I don't see them on the hostel and when I was testing a smartphone. Registration!




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2