Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8062873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:49:22+00:00 2026-06-05T10:49:22+00:00

So I have successfully deployed an app using webapp2/jinja2 and a Paste server, but

  • 0

So I have successfully deployed an app using webapp2/jinja2 and a Paste server, but am having trouble serving static stylesheets.

I have had luck accessing static files via this method, as well as implementing a StaticFileHandler I found with some google-fu:

import os
import mimetypes
import webapp2
import logging

class StaticFileHandler(webapp2.RequestHandler):
    def get(self, path):
        abs_path = os.path.abspath(os.path.join(self.app.config.get('webapp2_static.static_file_path', 'static'), path))
        if os.path.isdir(abs_path) or abs_path.find(os.getcwd()) != 0:
            self.response.set_status(403)
            return
        try:
            f = open(abs_path, 'r')
            self.response.headers.add_header('Content-Type', mimetypes.guess_type(abs_path)[0])
            self.response.out.write(f.read())
            f.close()
        except:
            self.response.set_status(404)

where my main app routing looks like:

app = webapp2.WSGIApplication([('/', HelloWorld),
                               (r'/display', DisplayHandler),
                               (r'/static/(.+)', StaticFileHandler)
                              ], debug=True)

My css files are in a folder under the app root: /static/css/main.css

I can access the file via direct url, and even link it as a stylesheet, but the styles won’t apply. Any ideas? Is there another way to serve stylesheets? Some way to implement an app.yaml similar to GAE?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T10:49:23+00:00Added an answer on June 5, 2026 at 10:49 am

    you dont need a static file handler.
    upload the app with the static file folder by adding this to your app.yaml

    - url: /static/
      static_dir: static
    

    docs are here: https://developers.google.com/appengine/docs/python/config/appconfig#Static_Directory_Handlers

    edit:
    see answer below in comments

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently, I have successfully deployed my ASP.NET App in the Production server. Now I
I have a Rails app deployed on Heroku with the Heroku scheduler add-on successfully
Hey dudes.i am having this problem while symlinking. I have successfully deployed a ruby
I have a website built using Django on Dreamhost deployed successfully with Passenger and
I have built a Java/Swing Application and I have successfully deployed it using Ant,
I have a web service application that I deployed successfully on Apache Tomcat using
I'm using sun java app server 8.0 PE, I have created webapplication and added
I have developed a Ruby on Rails application and successfully deployed on Weblogic using
i have a bit of stupid question, but i'm really having trouble with it.
I have deployed a Silverlight 5 PivotViewer web app that runs successfully on the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.