Static files from subfolder

44 views
Skip to first unread message

Andreas Lenhardt

unread,
Sep 17, 2020, 9:03:18 AM9/17/20
to Tornado Web Server
Hello,
my tornado app is served on domain.xyz/liveticker.
So the base entry point is /liveticker.
Unfortunately, I can not get the staticFileHelper to correcty use /liveticker/static as the source folder for my css/images/js files, as its always adressing /static.
How can I set this?

Pierce Lopez

unread,
Sep 17, 2020, 11:54:48 AM9/17/20
to python-...@googlegroups.com
You may just need to configure static_url_prefix in settings. Or, if you're not using the static_url() helper method to generate URLs for html and such, you can remove the static settings and instead manually configure the router for static assets like:

    static_path = os.path.join(os.path.dirname(__file__), "static")

    application = tornado.web.Application([
        (r"/liveticker/static/(.*)", tornado.web.StaticFileHandler, {"path": static_path}),
        ...
    ])

- Pierce



--
You received this message because you are subscribed to the Google Groups "Tornado Web Server" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-tornad...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python-tornado/5f286357-52f8-4211-913d-f70068e6bd85n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages