hafte: I think you posted to the wrong thread...

A friendly bump to the others: Is there a way to restrict access by IP
address in web2py's main/core routes.py?

Right now I'm doing it in appname/controllers/appadmin.py with this:
--snip--
if request.client not in ['x.x.x.x']:
    raise HTTP(404)
--snip--

And the same for admin/models/access.py:
--snip--
if request.client not in ['x.x.x.x']:
    raise HTTP(404)
--snip--

This does work and accomplish what I need, but it would be nice to do
it centrally from routes.py.


Thanks,

Marc

On Tue, Jul 5, 2016 at 12:14 PM, hafte agebash <haftineg...@gmail.com> wrote:
> tank you!!
> but i need to do with augmented traffic control simulation tool,and it needs
> some requirements django1.7 and python,so couldn't install django and atc
> tool
>
> On Tue, Jul 5, 2016 at 1:09 PM, Marc Smith <msmith...@gmail.com> wrote:
>>
>> Hi,
>>
>> I have a web2py app that is hosted on PythonAnywhere. I'd like to
>> restrict access to the "admin" application and the "appadmin" page of
>> my app by IP address. Ideally, I'd like to return a 404 to anyone that
>> doesn't match one or more IP addresses.
>>
>> Is this possible using the global routes.py? Or is there a better way
>> to do it from inside the "admin" app, and the "appadmin" controller?
>> Looked briefly for an example, but didn't see anything that got me
>> close enough.
>>
>> Any tips or advice/ideas would be greatly appreciated.
>>
>>
>> --Marc
>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to