[web2py] Matplotlib not loading on 2.12.3 while loading on 2.11.2

2015-09-07 Thread anonymous anonymous
I posted this question online and it seems that it would be useful to post 
it here.

tl;dr: I found a work around by creating a symbolic link to matplotlib in 
the modules folder.

http://stackoverflow.com/questions/32428845/why-does-matplotlib-not-work-on-a-digitalocean-vps-with-web2py

I've got a digitalocean droplet and I deployed web2py using this script 
.
 
I installed matplotlib as follows:


ssh root@ipdroplet
apt-get install python-matplotlib


and I can indeed import matplotlib if I simply run python on the command 
line after I've ssh'd. The problem is that when I run my app I get the 
following error:


 Cannot import module 
applications.app.modules.matplotlib

I'm guessing this has something to do with user www-data vs root but no 
idea how to resolve it. Any help much appreciated. The tips that are 
mentioned in this 
 
link unfortunately didn't help me.

Thanks

*EDIT*

I should also mention that I'm not using the binary version of web2py. I've 
also managed to run python as www-data by doing sudo -u www-data python and 
I can import matplotlib there just fine.

*EDIT2*

When I was running locally on web2py 2.11.2-stable it worked fine. On my 
server though I was under 2.12.3-stable. I'm guessing this is probably the 
reason.





-- 
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.


[web2py] Preference between programmaticaly building a page vs in .html view?

2015-06-21 Thread anonymous anonymous
Dear all,

this is my first post as well as my first attempt with web2py. I've read 
through most of the book and have the following question.

Here are a few guidelines I've understood:


   - Each controller/function should have it's own view
   - There are two ways to build up a webpage one is programmatically and 
   one is by modifying the view.

For example I could have a view:


# controller.py


def fun1():

return { 'content' : H1('Hello') + P('this is my first app World') }


def fun2():

return { 'content' : H1('Hello Again') + P('this is the second page') }


and 


views/controller/fun1.html


{{extend layout.html}}

{{=content}}


views/controller/fun2.html


{{extend layout.html}}

{{=content}}


The alternative would be:


# controller.py


def fun1():

return { }


def fun2():

return { }


and views:


views/controller/fun1.html


{{extend layout.html}}

h1'Hello'/h1

p'this is my first app World'/p


views/controller/fun2.html


{{extend layout.html}}

h1'Hello Again'/h1

p'this is the second page'/p


What is the difference, which is better practice? In this simple case which 
pattern is it advisable I follow?


Thank you

-- 
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.