Forums

subdomains

Hello, I have recently purchased the 'hacker pack' from pyanywhere and I've got a few questions which are located below.

-I'll get in a project that includes;

domain.tech forum.domain.tech blog.domain.tech

I'll configure my database so all of these subdomains will have the same member (log-in/out) list.

Let's get in the point, is it possible to use subdomains with the pack I have? I currently have rights to deploy only one app however I thought it might be possible with django's subdomain module (I haven't checked it out yet, just an idea).

I'd be glad if someone can delight me! Thanks!

If you need to host three sites (even if they're subdomains of the same domain) then you'll need three websites set up on the Web tab, unfortunately. If you click the "Customize your plan" button on the Account page, then you can add on two more without needing to upgrade to a Web Dev plan -- a Hacker plan with two extra websites would cost $9/month.

Hi there, I would like to have such a configuration. Do we have to use middlewares such as Django_hosts after creating/setting up the other web apps or is there a better approach?

No, you don't need any extra middleware. Each web app is just a separate Django site. django_hosts is where you want to route requests for different hosts to parts of the same Django site. On PythonAnywhere, each web app only gets requests for the specific host name that it is configured for.

Great!! Gonna try that. Thanks again for the fast reply Glenn

So, I have created more app so that I can be able to redirect to but I can't seem to figure out a way forward. I have an app names sub.domain.com for instance and configured the app settings on the "web apps" tab to point to the existing django project. @Glenn, can you please help?

I'm a bit confused what this redirect is doing- if it's 3 different domains, nothing would need to redirect to each other? Or do you mean link to each other?

Sorry...let me try to be more specific: Say I have a domain named developers.com I already have a Django project with 3 different app named main, public and last one blog which are currently all accessed under the same developers.com domain. I just purchased the ability to add 3 more Web Apps and already have CNAME configured at my domain registrar.

Now I would like to have requests to the app main redirected to main.developers.com, public to public.developers.com and so on... How can I achieve that ?

Create a web app for each URL and set each of them so they load the app for the address that they are at.

" ** set each of them so they load the app for the address that they are at**" This exactly is what I want to know, how to achieve this if using modules like Django_hosts is not necessary?

Just like you would for any Django app - you load the apps you want in settings and then use your urls to point to the views.

On PythonAnywhere, each web app will only receive requests for the address where the web app is, so something like Django_hosts would do nothing. If you wanted to, I suppose you could point each of your web apps at the same web app code and use Django_hosts to choose based on the domain. If that's a way you'd like to think about your web apps.