Relocated admin using router, problem with appadmin

85 views
Skip to first unread message

Marek Mollin

unread,
Sep 9, 2012, 3:42:52 PM9/9/12
to web...@googlegroups.com
Hello,
I ran into small problem.
I have web2py 2.08 running nginx + postgres.

I configured routes using parametric system.
In routes.py I defined domains and assigned admin to seperate domain.
By domain i mean actually subdomains...

test.app.com -> testing environment using seperate db
app.com -> official thing
admin.app.com -> admin for both apps and any other that may comeby....

Problem is:
Now I cannot access appadmin. (I have no uwsgi_log... just gateway timed out and have to restart server).

My routes.py

routers = dict(
        BASE
= dict(
                domains
= {
                       
'myapp.com' : 'myapp',
                       
'admin.myapp.com' : 'admin',
                       
'test.myapp.com' : 'testm',


               
},
                default_application
= 'myapp',
                applications
= ['myapp','admin','testm'],
                controllers
= 'DEFAULT',
                map_static
= True
       
),
        myapp
= dict(
                functions
= dict(
                        produkty
= ['index'],
                        rozmiary
= ['index'],
                        polityka
= ['index'],
               
),
       
),
)



Jonathan Lundell

unread,
Sep 9, 2012, 4:01:00 PM9/9/12
to web...@googlegroups.com
On 9 Sep 2012, at 12:42 PM, Marek Mollin <rog...@gmail.com> wrote:
Hello,
I ran into small problem.
I have web2py 2.08 running nginx + postgres.

I configured routes using parametric system.
In routes.py I defined domains and assigned admin to seperate domain.
By domain i mean actually subdomains...

test.app.com -> testing environment using seperate db
app.com -> official thing
admin.app.com -> admin for both apps and any other that may comeby....

Problem is:
Now I cannot access appadmin. (I have no uwsgi_log... just gateway timed out and have to restart server).

There's a problem with having admin in a different domain from an associated app, in that the URLs that cross the domains aren't specified as absolute URLs (that is, they don't have a domain attached to them). 

It might be possible to fix that in the parametric router, but noticing a) that the app specified in a URL() call is different from the calling app, and b) that the app in question is associated with a domain and/or port. But at present I don't think it'll work.

I'm not entirely certain of all this without reviewing the code. Another workaround would be to treat the domain as a hint, but allow the URL to override it by explicitly specifying the app. And maybe that happens, but there's a more subtle issue...

Turning on router logging might help explain what's going on.


My routes.py

routers = dict(
        BASE = dict(
                domains = {
                        'myapp.com' : 'myapp',
                        'admin.myapp.com' : 'admin',
                        'test.myapp.com' : 'testm',


                },
                default_application = 'myapp',
                applications = ['myapp','admin','testm'],
                controllers = 'DEFAULT',
                map_static = True
        ),
        myapp = dict(
                functions = dict(
                        produkty = ['index'],
                        rozmiary = ['index'],
                        polityka = ['index'],
                ),
        ),
)




--
 
 
 


Marek Mollin

unread,
Sep 9, 2012, 7:27:02 PM9/9/12
to web...@googlegroups.com
So if I skip the admin.app.com line domain I will get:

all working fine?

Marek Mollin

unread,
Sep 10, 2012, 5:43:38 AM9/10/12
to
Apparently,
I have two domains and there is no way for me to access admin.
I get gateway timeouts.

on logging I get permission denied

Marek Mollin

unread,
Sep 10, 2012, 8:28:38 AM9/10/12
to web...@googlegroups.com
To rephrase:
I need a sample routes.py with router between two domains (subdomains) getting two seperate applications with admin access enabled.

I urgently need help, thanks.


W dniu poniedziałek, 10 września 2012 11:17:57 UTC+2 użytkownik Marek Mollin napisał:
Apparently,
I have two domains and there is no way for me to access admin.
I get gateway timeouts.

on logging I get permission denied

W dniu poniedziałek, 10 września 2012 01:27:02 UTC+2 użytkownik Marek Mollin napisał:

Jonathan Lundell

unread,
Sep 10, 2012, 9:15:32 AM9/10/12
to web...@googlegroups.com
On 10 Sep 2012, at 2:17 AM, Marek Mollin <rog...@gmail.com> wrote:
Apparently,
I have to domains there is no way for me to access admin.
I get gateway timeouts.

I'll take a look at the code later today.


W dniu poniedziałek, 10 września 2012 01:27:02 UTC+2 użytkownik Marek Mollin napisał:

--
 
 
 


Marek Mollin

unread,
Sep 10, 2012, 12:02:28 PM9/10/12
to web...@googlegroups.com
So i have cut down the router to bare minimum, just to check this admin issue.
I now have:

routers = dict(
  BASE  = dict(
      domains = {
          'myapp.com' : 'myapp1',
          'test.myapp.com' : 'myapp2',
      }
  ),
)
logging = 'debug'

after tailing the uwsgi_log i get:

Error opening file for reading: Permission denied
and afterwards a few 404.

just a few 404.

If I turn off the domains and just set default app, everything is fine.
Admin is accessible.

Jonathan Lundell

unread,
Sep 10, 2012, 12:22:25 PM9/10/12
to web...@googlegroups.com
On 10 Sep 2012, at 9:02 AM, Marek Mollin <rog...@gmail.com> wrote:
So i have cut down the router to bare minimum, just to check this admin issue.
I now have:

routers = dict(
  BASE  = dict(
      domains = {
          'myapp.com' : 'myapp1',
          'test.myapp.com' : 'myapp2',
      }
  ),
)
logging = 'debug'

after tailing the uwsgi_log i get:

Error opening file for reading: Permission denied
and afterwards a few 404.

just a few 404.

If I turn off the domains and just set default app, everything is fine.
Admin is accessible.

That is, unfortunately, the expected behavior. I've asked the other developers to comment on a couple of proposed fixes.

--
 
 
 


Jonathan Lundell

unread,
Sep 11, 2012, 12:36:01 PM9/11/12
to web...@googlegroups.com
On 10 Sep 2012, at 9:02 AM, Marek Mollin <rog...@gmail.com> wrote:
So i have cut down the router to bare minimum, just to check this admin issue.
I now have:

routers = dict(
  BASE  = dict(
      domains = {
          'myapp.com' : 'myapp1',
          'test.myapp.com' : 'myapp2',
      }
  ),
)
logging = 'debug'

after tailing the uwsgi_log i get:

Error opening file for reading: Permission denied
and afterwards a few 404.

just a few 404.

If I turn off the domains and just set default app, everything is fine.
Admin is accessible.


There's a fix (I think) in the trunk for this problem. I'm not sure it's 100% fixed; if you try it out, please let me know. 

Marek Mollin

unread,
Sep 11, 2012, 3:04:17 PM9/11/12
to web...@googlegroups.com
"We be rollin" ;]
It works perfectly so far. Both admin and appadmin.
Relocating admin doesnt work but its no big deal I guess.

Thanks a million!

Jonathan Lundell

unread,
Sep 11, 2012, 3:15:41 PM9/11/12
to web...@googlegroups.com
On 11 Sep 2012, at 12:04 PM, Marek Mollin <rog...@gmail.com> wrote:
"We be rollin" ;]
It works perfectly so far. Both admin and appadmin.
Relocating admin doesnt work but its no big deal I guess.

What happens when you relocate admin? 


Thanks a million!

W dniu wtorek, 11 września 2012 18:36:12 UTC+2 użytkownik Jonathan Lundell napisał:
On 10 Sep 2012, at 9:02 AM, Marek Mollin <rog...@gmail.com> wrote:
So i have cut down the router to bare minimum, just to check this admin issue.
I now have:

routers = dict(
  BASE  = dict(
      domains = {
          'myapp.com' : 'myapp1',
          'test.myapp.com' : 'myapp2',
      }
  ),
)
logging = 'debug'

after tailing the uwsgi_log i get:

Error opening file for reading: Permission denied
and afterwards a few 404.

just a few 404.

If I turn off the domains and just set default app, everything is fine.
Admin is accessible.


There's a fix (I think) in the trunk for this problem. I'm not sure it's 100% fixed; if you try it out, please let me know. 

--
 
 
 


Marek Mollin

unread,
Sep 11, 2012, 3:27:15 PM9/11/12
to web...@googlegroups.com
It fires up default app.

Marek Mollin

unread,
Sep 11, 2012, 3:34:27 PM9/11/12
to
Checked again with restarting entire server and it seems fine.

Redirects to admin just fine:
small problem starts when you enter particular's app appadmin it goes under url: admin.myapp.com/myapp/appadmin
and css goes a bit wierd:


other tiny issue might be:
that myapp.com/myapp1 is accessible as well as myapp.com/myapp2 but I will try to mess with it...

Jonathan Lundell

unread,
Sep 11, 2012, 3:36:52 PM9/11/12
to web...@googlegroups.com
On 11 Sep 2012, at 12:32 PM, Marek Mollin <rog...@gmail.com> wrote:
Checked again with restarting entire server and it seems fine.

Redirects to admin just fine:
small problem starts when you enter particular's app appadmin it goes under url: admin.myapp.com/myapp/appadmin

Post the router, please. I'll experiment when I get the chance.

Where/when do you see the above URL, exactly? 

and css goes a bit wierd:

Marek Mollin

unread,
Sep 11, 2012, 5:01:03 PM9/11/12
to web...@googlegroups.com
I will test and provide further tomorrow.
Thanks for quality involment.
Reply all
Reply to author
Forward
0 new messages