Run Django with URL prefix (“subdirectory”) - App works, but URLs broken?

后端 未结 2 931
后悔当初
后悔当初 2020-12-16 02:03

Below are the relevant configuration files, also at http://dpaste.com/97213/ .

The apache config is currently working, because accessing \'example.com/\' shows me th

相关标签:
2条回答
  • 2020-12-16 02:19

    This is a possible duplicate of Django Apache Redirect Problem, as that answer solved this problem.

    I only eventually stumbled on that answer by opening almost all of the 'related questions' here, just out of desperation. From my perspective, I think my question has some valuable "search friendly" words.

    EDIT: The answer: (via alex vasi)

    Things to try:

    1. Change current domain to "yourdomain.tld/cflow" in the "sites" framework. It's easy to do using django admin or dumpdata/loaddata manage.py commands.
    2. Looks like your site is using login_required decorator. In that particular case you can add to settings.py:

      LOGIN_URL = '/[prefix]/accounts/login/'

    0 讨论(0)
  • 2020-12-16 02:22

    In your urls.py rename urlpatterns to base_urlpatterns; then add the followinig definition at the end of the same file:

    urlpatterns = patterns('',
        '^', include(base_urlpatterns), # iff you wish to maintain the un-prefixed URL's too
        '^your_prefix/', include(base_urlpatterns),
    )
    
    0 讨论(0)
提交回复
热议问题