Setup virtual hosting with Web2py and apache2 mod wsgi on Ubuntu server 11.10

Ubuntu server are easy to use and you can choose from a lot of vps services out there like linode. This guide cover the last version of ubuntu server at the moment: 11.10. Also this is the recommended way to use web2py in production enviroment and is the recommended way if you want to host also html, php, ruby applications, etc. This describe how to setup apache2 to serve our web2py applications in apache2 virtual hosting enviroment. I presume that you have already running and correctly setup ubuntu server 11.10. There are several guides about how to do it. 


Click on read more to view the guide
Read more
No Responses

Working in a new version of instant press

I'm working in a new version of instant press, the new version come with this changes:

  • I replace the markitup editor with cleditor, this a lightweight WYSIWYG HTML editor.
  • New upload system better than the old one.
  • Uploads to static folder, faster to display images.
  • Many bug fixed and highly perfomance improvement over the 2.1.0 version
  • Added Disqus comment option.
  • Jquery Colorbox, lightbox as default.

Screenshots

displaying articles now show published column


New admin panel

Manage image upload directly in the editor


Add or remove images in upload listing

Read more
No Responses

Photos working as sailing instructor

Some photos working as sailing instructor in my local sailing club: Club NĂ¡utico ParanĂ¡.  This is where was taken the photos.


Click on read more to view the rest.
Read more
No Responses

Web2py long term projects: Experiences?

This question about long term projects experiences came in the web2py groups. I can tell my experience from working for about 2 years with web2py or more I think. I work in different projects, one I currently developing I think is quite big, with millons of records, and is very complex and has many lines of code and tables, is an internal application for a national company. Also I worked in instant press from 1 year ago or more, and many other applications. 

In matter of scaling what I can say. Don't keep it with the basic. For me this is python and the important is the code, the beauty of the code, make sure that you application use modules, yes import is a great thing, this keep you code well order, take in mind nobody wants to read an awfull code, and in a future you can add new code and debug the problems easily. When you have a big app, models are not a good idea, this is why some experience developers quite from using web2py, the problem is that are giving up too fast, because you can avoid using models in web2py app, or at least using elemental models. You can read more why in my slides from last pycon at argentina (sorry it's in spanish only). Also you can read examples like lessmodel application from bruno rocha or the plugin aproach by kenshi here http://dev.s-cubism.com/plugin_jstree these are good example on how to start coding in my point of view.


Scheduler is another great piece of code, it's small but pretty powerfull, It's really nice and I use a lot. I don't know why the people are not using more. You can run a long time task to avoid timeout of the server and client with long tasks. You can make easyly that some controller in your app after sending a form for example, make a new task, that are going to be consumed by another process in background.

Dal, Database access layer, well in my experience is great but not always I can use full of it. Many times I have heavly or complex queries that I have to pass it with executesql. But dal is working pretty well with this mix.

About "breakage" when upgrating web2py, yes I have some, but it's my fault because sometimes I'm using experimental features and not stable, I want always the last features, I remember scheduler and grid give me some trouble with this. But in generally I have running application of about 2-3 years ago with the last version. 
Read more
No Responses

My slides from pycon argentina

I upload my slides from pycon argentina, about new features and future of web2py. You can view it online  here.
Read more
No Responses

Default application in web2py

Edit: Updated, Jonathan point me that I'm wrong. Thanks.

The easy way to setup that our application is going to be default application in web2py, is to name the app as 'init'. With default application I mean when we put in our browser http://www.mysite.com/ or http://localhost/:8000, (controlled under web2py), the default application is going to be served.

There are another method introduced with the new router by Johnathan Lundell. (I take this from the web2py user group).

First we have to rename router.example.py to routes.py it's located in the web2py folder. Make a backup of the file if this already exist in your web2py folder.

1.
mv router.example.py routes.py

Let's edit routes.py and look after this code:

1.
2.
3.
4.
5.
6.
7.
routers = dict(

# base router
BASE = dict(
default_application = 'welcome',
),
)

we are going to change default_application with our desire application name. Save the file and now if we introduce www.mysite.com in our browser we are getting our application instead of welcome application page. The same if we are testing in local machine, if we introduce http://localhost:8000

Note: After edit routes.py we have to re run web2py, if we want changes take effect.

This hide the application name from the url if we want the name in the url we need to do this

Instead of

http://localhost:8000/default/index
to have
http://localhost:8000/myapp/default/index
We have to edit routes.py again and add application=None
1.
2.
3.
4.
5.
6.
7.
8.
routers = dict(

# base router
BASE = dict(
default_application = 'myapplication',
applications = None,
),
)

That's all!.

Read more
No Responses