librelist archives

« back to archive

Subdomain dispatching with two separate Flask app

Subdomain dispatching with two separate Flask app

From:
Adam Jacobus
Date:
2014-01-30 @ 01:26
Hi

I was wondering if it would be possible for me to have two Flask app deal
with subdomain dispatching for a single host.

I have a main site for the url and an app that only runs on subdomains. I
want to ensure that all requests for "url.com" go to the main site and all
requests for "sub.url.com" go to the app.

Preferably, I would like the site and the app to run in two separate
processes, not in one WSGI container.

Thanks.

Re: [flask] Subdomain dispatching with two separate Flask app

From:
Viktor Evdokimov
Date:
2014-01-30 @ 03:47
Here is the link to uwsgi setup 
http://flask.pocoo.org/docs/deploying/uwsgi/ in official docs, however I 
really find it confusing. Also it is using unix pipes which require proper
permissions to use.
Here is shortest and simplest how to I found , but it is in Russian. 
http://translate.google.com/translate?hl=en&sl=ru&tl=en&u=http%3A%2F%2Fawolf.ru%2Fblog%2Fflask-uwsgi-nginx
check original version for unobfuscated snippets



--  
Best,   
ᏛᎧ




On Wednesday, January 29, 2014 at 8:26 PM, Adam Jacobus wrote:

> Hi
>  
> I was wondering if it would be possible for me to have two Flask app 
deal with subdomain dispatching for a single host.
>  
> I have a main site for the url and an app that only runs on subdomains. 
I want to ensure that all requests for "url.com (http://url.com)" go to 
the main site and all requests for "sub.url.com (http://sub.url.com)" go 
to the app.  
>  
> Preferably, I would like the site and the app to run in two separate 
processes, not in one WSGI container.
>  
> Thanks.  

Re: [flask] Subdomain dispatching with two separate Flask app

From:
Viktor Evdokimov
Date:
2014-01-30 @ 03:41
It is pretty trivial to do when you are deploying as wsgi module in nginx 
+ uwsgi setup or apache + uwsgi.  
- for nginx you are creating two sites and tell them pass requests to two 
uwsgi apps two different ports 8888 and 9999
- in uwsgi you are creating two apps and set them app to listen to 
corresponding ports



--  
Best,   
ᏛᎧ




On Wednesday, January 29, 2014 at 8:26 PM, Adam Jacobus wrote:

> Hi
>  
> I was wondering if it would be possible for me to have two Flask app 
deal with subdomain dispatching for a single host.
>  
> I have a main site for the url and an app that only runs on subdomains. 
I want to ensure that all requests for "url.com (http://url.com)" go to 
the main site and all requests for "sub.url.com (http://sub.url.com)" go 
to the app.  
>  
> Preferably, I would like the site and the app to run in two separate 
processes, not in one WSGI container.
>  
> Thanks.  

Re: [flask] Subdomain dispatching with two separate Flask app

From:
Adam Jacobus
Date:
2014-01-30 @ 03:46
Can they listen on the same outward port?


On Thu, Jan 30, 2014 at 1:41 PM, Viktor Evdokimov <ojosdegris@gmail.com>wrote:

> It is pretty trivial to do when you are deploying as wsgi module in nginx
> + uwsgi setup or apache + uwsgi.
> - for nginx you are creating two sites and tell them pass requests to two
> uwsgi apps two different ports 8888 and 9999
> - in uwsgi you are creating two apps and set them app to listen to
> corresponding ports
>
>
>
> --
> Best,
> ᏛᎧ
>
> On Wednesday, January 29, 2014 at 8:26 PM, Adam Jacobus wrote:
>
> Hi
>
> I was wondering if it would be possible for me to have two Flask app deal
> with subdomain dispatching for a single host.
>
> I have a main site for the url and an app that only runs on subdomains. I
> want to ensure that all requests for "url.com" go to the main site and
> all requests for "sub.url.com" go to the app.
>
> Preferably, I would like the site and the app to run in two separate
> processes, not in one WSGI container.
>
> Thanks.
>
>
>

Re: [flask] Subdomain dispatching with two separate Flask app

From:
Viktor Evdokimov
Date:
2014-01-30 @ 03:50
Yes, nginx will listen to port 80 and pass request to two local ports


--  
Best,   
ᏛᎧ




On Wednesday, January 29, 2014 at 10:46 PM, Adam Jacobus wrote:

> Can they listen on the same outward port?
>  
>  
> On Thu, Jan 30, 2014 at 1:41 PM, Viktor Evdokimov <ojosdegris@gmail.com 
(mailto:ojosdegris@gmail.com)> wrote:
> > It is pretty trivial to do when you are deploying as wsgi module in 
nginx + uwsgi setup or apache + uwsgi.  
> > - for nginx you are creating two sites and tell them pass requests to 
two uwsgi apps two different ports 8888 and 9999
> > - in uwsgi you are creating two apps and set them app to listen to 
corresponding ports
> >  
> >  
> >  
> > --  
> > Best,   
> > ᏛᎧ
> >  
> >  
> >  
> >  
> > On Wednesday, January 29, 2014 at 8:26 PM, Adam Jacobus wrote:
> >  
> > > Hi
> > >  
> > > I was wondering if it would be possible for me to have two Flask app
deal with subdomain dispatching for a single host.
> > >  
> > > I have a main site for the url and an app that only runs on 
subdomains. I want to ensure that all requests for "url.com 
(http://url.com)" go to the main site and all requests for "sub.url.com 
(http://sub.url.com)" go to the app.  
> > >  
> > > Preferably, I would like the site and the app to run in two separate
processes, not in one WSGI container.
> > >  
> > > Thanks.  
> >  
>  

Re: [flask] Subdomain dispatching with two separate Flask app

From:
Adam Jacobus
Date:
2014-01-30 @ 03:56
And will it definitely use the site for urls without subdomains and the app
for urls with subdomains?


On Thu, Jan 30, 2014 at 1:50 PM, Viktor Evdokimov <ojosdegris@gmail.com>wrote:

> Yes, nginx will listen to port 80 and pass request to two local ports
>
>
> --
> Best,
> ᏛᎧ
>
> On Wednesday, January 29, 2014 at 10:46 PM, Adam Jacobus wrote:
>
> Can they listen on the same outward port?
>
>
> On Thu, Jan 30, 2014 at 1:41 PM, Viktor Evdokimov <ojosdegris@gmail.com>wrote:
>
> It is pretty trivial to do when you are deploying as wsgi module in nginx
> + uwsgi setup or apache + uwsgi.
> - for nginx you are creating two sites and tell them pass requests to two
> uwsgi apps two different ports 8888 and 9999
> - in uwsgi you are creating two apps and set them app to listen to
> corresponding ports
>
>
>
> --
> Best,
> ᏛᎧ
>
> On Wednesday, January 29, 2014 at 8:26 PM, Adam Jacobus wrote:
>
> Hi
>
> I was wondering if it would be possible for me to have two Flask app deal
> with subdomain dispatching for a single host.
>
> I have a main site for the url and an app that only runs on subdomains. I
> want to ensure that all requests for "url.com" go to the main site and
> all requests for "sub.url.com" go to the app.
>
> Preferably, I would like the site and the app to run in two separate
> processes, not in one WSGI container.
>
> Thanks.
>
>
>
>
>

Re: [flask] Subdomain dispatching with two separate Flask app

From:
Viktor Evdokimov
Date:
2014-01-30 @ 03:59
yeah you will setup url mapping in nginx site configs


--  
Best,   
ᏛᎧ




On Wednesday, January 29, 2014 at 10:56 PM, Adam Jacobus wrote:

> And will it definitely use the site for urls without subdomains and the 
app for urls with subdomains?
>  
>  
> On Thu, Jan 30, 2014 at 1:50 PM, Viktor Evdokimov <ojosdegris@gmail.com 
(mailto:ojosdegris@gmail.com)> wrote:
> > Yes, nginx will listen to port 80 and pass request to two local ports
> >  
> >  
> > --  
> > Best,   
> > ᏛᎧ
> >  
> >  
> >  
> >  
> > On Wednesday, January 29, 2014 at 10:46 PM, Adam Jacobus wrote:
> >  
> > > Can they listen on the same outward port?
> > >  
> > >  
> > > On Thu, Jan 30, 2014 at 1:41 PM, Viktor Evdokimov 
<ojosdegris@gmail.com (mailto:ojosdegris@gmail.com)> wrote:
> > > > It is pretty trivial to do when you are deploying as wsgi module 
in nginx + uwsgi setup or apache + uwsgi.  
> > > > - for nginx you are creating two sites and tell them pass requests
to two uwsgi apps two different ports 8888 and 9999
> > > > - in uwsgi you are creating two apps and set them app to listen to
corresponding ports
> > > >  
> > > >  
> > > >  
> > > > --  
> > > > Best,   
> > > > ᏛᎧ
> > > >  
> > > >  
> > > >  
> > > >  
> > > > On Wednesday, January 29, 2014 at 8:26 PM, Adam Jacobus wrote:
> > > >  
> > > > > Hi
> > > > >  
> > > > > I was wondering if it would be possible for me to have two Flask
app deal with subdomain dispatching for a single host.
> > > > >  
> > > > > I have a main site for the url and an app that only runs on 
subdomains. I want to ensure that all requests for "url.com 
(http://url.com)" go to the main site and all requests for "sub.url.com 
(http://sub.url.com)" go to the app.  
> > > > >  
> > > > > Preferably, I would like the site and the app to run in two 
separate processes, not in one WSGI container.
> > > > >  
> > > > > Thanks.  
> > > >  
> > >  
> >  
>  

Re: [flask] Subdomain dispatching with two separate Flask app

From:
Adam Jacobus
Date:
2014-01-30 @ 04:02
Thanks a lot.


On Thu, Jan 30, 2014 at 1:59 PM, Viktor Evdokimov <ojosdegris@gmail.com>wrote:

> yeah you will setup url mapping in nginx site configs
>
>
> --
> Best,
> ᏛᎧ
>
> On Wednesday, January 29, 2014 at 10:56 PM, Adam Jacobus wrote:
>
> And will it definitely use the site for urls without subdomains and the
> app for urls with subdomains?
>
>
> On Thu, Jan 30, 2014 at 1:50 PM, Viktor Evdokimov <ojosdegris@gmail.com>wrote:
>
> Yes, nginx will listen to port 80 and pass request to two local ports
>
>
> --
> Best,
> ᏛᎧ
>
> On Wednesday, January 29, 2014 at 10:46 PM, Adam Jacobus wrote:
>
> Can they listen on the same outward port?
>
>
> On Thu, Jan 30, 2014 at 1:41 PM, Viktor Evdokimov <ojosdegris@gmail.com>wrote:
>
> It is pretty trivial to do when you are deploying as wsgi module in nginx
> + uwsgi setup or apache + uwsgi.
> - for nginx you are creating two sites and tell them pass requests to two
> uwsgi apps two different ports 8888 and 9999
> - in uwsgi you are creating two apps and set them app to listen to
> corresponding ports
>
>
>
> --
> Best,
> ᏛᎧ
>
> On Wednesday, January 29, 2014 at 8:26 PM, Adam Jacobus wrote:
>
> Hi
>
> I was wondering if it would be possible for me to have two Flask app deal
> with subdomain dispatching for a single host.
>
> I have a main site for the url and an app that only runs on subdomains. I
> want to ensure that all requests for "url.com" go to the main site and
> all requests for "sub.url.com" go to the app.
>
> Preferably, I would like the site and the app to run in two separate
> processes, not in one WSGI container.
>
> Thanks.
>
>
>
>
>
>
>