0

i have an application that uses appengine with python. Its a social network that maps places. I want to have each place in this kind or url: www.mysite.com/place/nameoftheplace

for that i did this regular expression as a parameter of mine WSGIApplication:

r'/place/(.*)' 

and on the get requisition i have:

def get(self, placeName=""):

but for some reason, if i call www.mysite.com/place/theplace, it enters the get with placeName = "theplace" and after the get ends, it call itself over and over, with a diferent placename like "/css/something". Can anyone help me? Thank you very much.

4
  • Any particular reason you are using regular expressions? Commented Apr 5, 2011 at 21:38
  • do you have a better ideia so i can create redirect every /place/nameoftheplace to the same GET requisition? Commented Apr 5, 2011 at 21:46
  • 1
    @nightcracker Because that's the appropriate way to do this in the App Engine webapp framework? Commented Apr 6, 2011 at 1:03
  • How are regex'es appropriate when urlparse exists? Commented Apr 6, 2011 at 6:55

1 Answer 1

2

It sounds like you're using relative URLs in your <link rel-'stylesheet' href='css/something'> tags in your HTML, so the browser is trying to fetch /place/css/something.


In your HTML, use, e.g., <link rel='stylesheet' href='/static/something.css'>, and in app.yaml use:

- url: /static/
  static_dir: static

then place your CSS in the static directory.

Sign up to request clarification or add additional context in comments.

2 Comments

yes, you are right. How can i solve that? I have lots of relative URLs so its almost impossible to clear that out. Is there any other regular expression that can help me? Like if i take out the '/'. How can i make it? Thanks
@user469631 You'll simply have to find the relative URLs and prefix them with / - this is a bug in your markup.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.