web2py URL are not based on filepaths, with the exception of files in the
/static folder. All other URLs are in /app/controller/function/list/of/args
format. You cannot access a file in the /uploads folder simply by putting
/uploads in the URL. Rather, the URL must point to a controller and
function that handles retrieving and streaming the file (the
/default/download function in the welcome app does this for files that have
been uploaded via a DAL upload field).
Anthony
On Wednesday, January 22, 2014 4:30:24 PM UTC-5, aapaap wrote:
>
> thanks,
> got in not working yet.
> I also tried the solution suggested in "pass as parameter or import"
> about an our later, but that didn't worked either.
>
> I don't understand the path philosophy of web2py at this moment.
>
> e.g.
> why is this working:
> <img height="100px" src="{{= URL ( 'static', 'images', args='pic_%s.png'%
> record.id )}}" />
>
> and why is this NOT working:
> <img height="100px" src="{{= URL ( 'uploads', 'images', args='pic_%s.png'%
> record.id )}}" />
>
> while the images are in both directories.
>
> cheers,
> Stef
>
> On 22-01-14 4:07, Anthony wrote:
>
> Please see
> http://web2py.com/books/default/chapter/29/04/the-core#Accessing-the-API-from-Python-modules
> .
>
> On Tuesday, January 21, 2014 7:14:05 PM UTC-5, aapaap wrote:
>>
>> thanks Anthony,
>> the import now works partially.
>>
>> The lib needs to know the database "db" is it possible to import that.
>> from db import db
>> doesn't work
>>
>> cheers,
>> Stef
>>
>> On 21-01-14 23:55, Anthony wrote:
>>
>> Filename = os.path.join ( 'applications',
>>> request.application,'static\images\pic_%s.png' % Edit_Select), 'wb')
>>>
>>
>> os.path.join(request.folder, 'static', 'images', 'pic_%s.png' %
>> Edit_Select)
>>
>> Q2:
>>> I made some libraries that I want to use more than one project.
>>> Now I stored these in
>>> ..controllers/my_support_libs.py
>>>
>>
>> Controllers are not Python modules and cannot be imported. If you need
>> to share a module, put it anywhere in the pythonpath and import from there.
>> You can put it in the /modules folder of a given app and import from other
>> apps via:
>>
>> import applications.myapp.modules.mymodule
>>
>> Anthony
>> --
>> 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 [email protected].
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>> --
> 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 [email protected] <javascript:>.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
--
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.