0

When user have registered at site, he get a special page on url:

/special/user=<user_id>

These pages doing some tasks. But, at some moment User can add his own domain to this page. With his DNS provider, he create A records that resolve server IP addresses. The same functionality is on a github pages. How can i do that ?

YPCrumble
  • 26,610
  • 23
  • 107
  • 172
Arti
  • 7,356
  • 12
  • 57
  • 122
  • You should "catch" the domain/hostname in your web server config and add that as a path element to the Django url you're reverse proxying. It might be possible to do this with bare Django, but you shouldn't deploy it that way. – dylrei Feb 02 '15 at 20:31
  • can you show simple example? I have a idea, to create a file with server names from database that will be updated every n hours. And that file include to main nginx config. And in django in middleware check if this domain in user domains database ... – Arti Feb 02 '15 at 22:01
  • Sounds about right. The main thing is that you're doing this in nginx. From the Django perspective, the domain/host should probably be signaled by part of the path created by nginx. – dylrei Feb 02 '15 at 23:56

1 Answers1

0

You can configure it using django-hosts, so you wouldn't have to mess with web server itself ad do everything in django. If you will give me some concrete examples, I could help you with configuring this app.

Edit

I am not sure how to tackle that problem, since I can not think of any way you can get any information from arti.com if you don't have access to the actual server arti.com is pointing to. However, I can suggest not using referer=Arti style patterns in urls, use something like that instead: url(r'^invite/(?P<referer>[\w-]+)/', ...) this way it won't be stripped out.

Also with django-hosts you can setup urls with subdomains. Basically you could setup urls to be arti.mysite.com, then in view you would have access to subdomain part, arti in this example, which I believe can solve part of your problem.

Community
  • 1
  • 1
lehins
  • 9,642
  • 2
  • 35
  • 49
  • every user have a referral link to invite another users. But when he have posted it at some forums and others resources, many users will crop referral id and other parameters. So to avoid this, this user can add own domain to his referral page. This task stands before me. P.S. And i have already used https://github.com/wardi/django-dynamicsites-lite for control few sites from one admin panel – Arti Feb 03 '15 at 07:53
  • I am not sure I fully understand the actual problem, can you give an example with full urls of a referral link, domain on referal page etc. – lehins Feb 03 '15 at 09:24
  • i can't, What you didn't understand ? For example: I have registered at my site with nickname Arti. In my profile i have a link: www.mysite.com/invite/refferal=Arti. If anyone register at the site using this link - i will get bonuses. And in my options i can use my own domain, for example: www.arti.com(with my DNS provider where i have created A record that resolve server IP addresses. ). And then when users go to www.arti.com, i will have the same functionallity like in www.mysite.com/invite/refferal=Arti page. – Arti Feb 03 '15 at 10:36
  • Ok, it makes more sense now. I'll add my comment in the actual answer. – lehins Feb 03 '15 at 19:17