简体   繁体   中英

What is the python regex to match everything?

So I have a django site with only 1 app, but I want to maintain the suggested folder structure so I want all incoming requests to the root url conf to go to that 1 app's urls.py

Essentially I have a structure like

site/  
    site/
        urls.py
        settings.py
        ...
    app/
        urls.py
        ...

And I want site/urls.py to simply look like this

url(r'*matching anything here*', include('app.urls')),

I just can't figure out how to make a regex expression to match any set of characters of any length. Essentially EVERYTHING.

I tried using

r'(?i).' 

but it still seems to fail

For include you need to give the path prefix; it's ^ in this case:

url(r'^', include('app.urls')),

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM