WebFaction
Community site: login faq

I'd like to know if this is possible..

I've setup Wordpress for my so-called corporate site (www.runaroo.com)

Django is the actual platform that users will log into (social network) - http://jdub.webfactional.com/test-tribe/

I'd like the domain name of the Django app to be www.runaroo.com/test-tribe

Can this be done? Or is it better practice to register another domain name, and use that for the Django app..

asked 16 Apr '11, 22:04

jdub
123
accept rate: 0%

hi ryan, would it be possible to point <someclubname>.runaroo.com to the django app (and all inclusive paths) while www.runaroo.com points to the Wordpress app?

(17 Apr '11, 08:11) jdub

Yes, it is possible. You simply need to have two separate Websites created in the Control Panel - one for <someclubname>.runaroo.com and another one for www.runaroo.com

(18 Apr '11, 09:36) tie

Thanks for the reply.

If users are creating Groups with a unique <someclubname>.runaroo.com URL on my Social Networking site (running on my Django app), can this be automatically done when as soon as the Group is created (and URL specified)?

Not sure if this is the advisable route for trying to achieve what I want here.

(18 Apr '11, 12:10) jdub

I believe what you are wanting is a wildcard entry for the subdomain, *.domain.com.

(18 Apr '11, 12:22) timg ♦♦

yes yes, that is correct. So it is possible.. possibly some kind of script or via your API? I had asked a question regarding this in a separate topic before, and was told:

"You could probably script this up in Python fairly easily giving users a button that edits your apache2/conf/httpd.conf adding a new virtualhost and creates a new pinax project that they are able to work with, but I don't know of any actual resources that give any info on the exact how to do this."

Can you confirm this is what I should indeed pursue?

(18 Apr '11, 12:38) jdub

No, you shouldn't need to use VirtualHosts or do anything with the API to use *.domain.com for your particular application. The solution you have referred to is related to something slightly different (where someone would try to have a separate application directory for each subdomain but only have a single website record in the control panel)

All you will need to do is point *.domain.com to your application, and then use HttpRequest.META['HTTP_HOST'] in Django to see which domain is being used.

(18 Apr '11, 19:53) ryans ♦♦

I'm copying and pasting an answer that Ryans had posted last year July, when I asked this question. I just found it on the old Forum when I did a search regarding this topic. Thought I'd post it here if anybody else is interested in this sort of thing...

This can be done using wildcard subdomains.

In the Control Panel, create a domain and assign it the subdomain of "*" (only). Then, point this domain at your django application using a site record.

So, you would have a site record with two domains and pointing to your django application:

Site Record Domains Site apps: runaroo runaroo.com / : django *.runaroo.com /media : django_static_media /media/admin : django_admin_media

Replacing your application names and relevant Site URL mount points.

What this does is point runaroo.com and *.runaroo.com to your application. So, if someone types "joe.runaroo.com", they get to your application.

Then, you have your application dynamically determine its URL with something like this:

from django.contrib.sites.models import Site
current_site = Site.objects.get_current()
the_domain_name = current_site.domain

And you can split the username off with something like:

the_domain_name.split('.')[0]

More information on getting a domain dynamically can be found here: http://docs.djangoproject.com/en/1.2/re … or-display

And more information on Wildcard Subdomains (in a Wordpress MU context) can be found here: Step (6) of http://docs.webfaction.com/software/wor … -multisite

Hope that helps!

Regards, Ryan S. WebFaction Support

(18 Apr '11, 22:36) jdub
showing 5 of 7 show 2 more comments

Yes, you can do this using website records. Please see the following related topic:

http://community.webfaction.com/questions/3095/how-to-organize-a-static-indexhtml-and-future-djangowordpress-app

Hope that helps!

permanent link

answered 16 Apr '11, 22:15

ryans ♦♦
5.0k93360
accept rate: 43%

Thanks. Read through it.

Ok, so I have one caveat.

On the Django app, I want to allow users to specify their own Groups URL (users can create their own groups on the social network), so that it's www.runaroo.com/<their own="" unique="" group="" name="">

But if my Wordpress app is using the base URL of runaroo.com, could this work?

(16 Apr '11, 22:59) jdub

Yes and no. In general, this doesn't seem feasible because your URLs are only loosely (and possibly inadequately) defined. What happens when your Wordpress application attempts to create and use a new URL where some group has been mounted?

If you specify a consistent approach to the above scenario, then it is possible to accomplish this by modifying the website record dynamically from within your Django application via our API as users register new groups.

(16 Apr '11, 23:07) ryans ♦♦

Hi, what do you mean by 'If you specify a consistent approach to the above scenario' ?

On the site, it will always be the case that to create a Group on the site, the user must specify a unique Group name. Is that what you mean?

(16 Apr '11, 23:34) jdub

Actually, I'm referring to what happens when a user creates a group named something like "new", giving the URL of http://www.runaroo.com/new/ and then later a Wordpress post or page is created that also tries to use the URL http://www.runaroo.com/new/ .

The easy way to solve this would be to have something like:

http://www.runaroo.com/groups/...

and then just mount /groups on your Django application. This is perhaps a little less pleasing to the eye, but also solves the above problem and also prevents the need to have any dynamic updating of the website record (which usually requires a few minutes to take effect after the change has been made).

(16 Apr '11, 23:45) ryans ♦♦

ryans, thanks for the help. am going to sleep right now, but will want to continue this discussion tmrw as I have followup questions for alternative solution.. like using subdomain...

<some club="" name="">.runaroo.com

(16 Apr '11, 23:58) jdub

Certainly.

Using a subdomain is a great solution because you can map the wildcard subdomain of *.runaroo.com to your Django application and also won't need to update the website record with the API.

In the case of "www.runaroo.com", you would just have your Django application return a 301 redirect to "runaroo.com" and use "runaroo.com" for the Wordpress application.

(17 Apr '11, 00:04) ryans ♦♦

hi ryan, my question is can i have this setup using <someclubname>.runaroo.com

where the above is for the Django app..

and www.runaroo.com continues to be the Wordpress app?

(17 Apr '11, 07:53) jdub

Yep, that'll work perfectly :)

(17 Apr '11, 07:55) David L ♦♦

hi ryan,

would it be possible to use the URL < someclubname > .runaroo.com for the django app, and use www.runaroo.com as the wordpress app?

(17 Apr '11, 08:09) jdub

Perhaps possible, but much more difficult. It would be best to run your wordpress site on "runaroo.com" but then 301 redirect "www.runaroo.com" to "runaroo.com" so that visitors can still arrive at your website from www.runaroo.com.

If you try to make "www.runaroo.com" the "base" domain for wordpress, then you can't point *.runaroo.com to django, because *.runaroo.com includes www.runaroo.com. Also, if you did that, it leaves runaroo.com undefined.

(18 Apr '11, 19:16) ryans ♦♦
showing 5 of 10 show 5 more comments
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×909
×244

question asked: 16 Apr '11, 22:04

question was seen: 8,061 times

last updated: 18 Apr '11, 22:36

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM