In a django web application, how do you give users their own subdomain?

后端 未结 3 420
暗喜
暗喜 2020-12-22 16:46

I\'m starting a new web app project using Django and Pinax. I want to be able to give my users unique domain names like Wordpress and other sites do : username.wordpre

3条回答
  •  天命终不由人
    2020-12-22 17:33

    You need to handle this via your webserver. If you have Django urls like...

    /users//
    

    ... then use rewrite rules in the webserver to map .domain.com to domain.com/users//.

    If you're using Apache, you can read up here. Otherwise, each webserver has their own conventions but all will support the notion of url rewrites.

提交回复
热议问题