On Nov 11, 12:38 am, Jan Koprowski <[email protected]> wrote:
> On Thu, Nov 11, 2010 at 7:19 AM, Andrew <[email protected]> wrote:
> > Hi,
>
> > I'm currently learning pylons (and python) and would like some help on
> > a project, I believe I have the right approach but I am not sure of
> > how the MVC would be structured.
>
> One of the goals of MVC is to cover many different languages/dialects
> like: SQL, HTML, partialy CSS and JavaScript by one language - in Your
> situation Python. So. The goal is You must not need know any of these
> language (or almost none of them) - You can know only Python (and
> Pylons) and still make webpage.

Personally, I don't think this has anything to do with MVC and might
confuse the discussion.


> One of the others goals is keep away three things: Database (data),
> Python (logic) and Visualization/Presentation (HTML/CSS)
>
>
>
>
>
> > ==What I am trying to do==
> > Let me explain a bit more of what I am trying to do.
> > Suppose there is a database, exampledb, and I would like to be able to
> > pull data out of that database (I am using SQLAlchemy and python
> > MySQL), and display that data on a web page.
>
> > At the moment, I am able to display values I pull from the exampledb
> > database on the console (using a simple controller script below) but I
> > need some help using it with MVC and displaying on a webpage.
>
> > == What I Understand ==
> > - I understand the controller will call on the models or the views and
> > return data to the model (please correct if this is wrong).
> > - The model is where I can put the database connection (for example,
> > like the script below) and query and store the values into variables.
> > - Then I would use a MAKO template to display those variables on a
> > webpage, but I am not sure of how to assign the variables or define
> > the function in the model/controller.
>
> > Can someone assist me with this please? Perhaps provide an example
> > would be helpful!
>
> Please look at this chapter of Pylons book: This is almost everything
> You try to 
> do:http://pylonsbook.com/en/1.1/starting-the-simplesite-tutorial.html
>
>
>
>
>
> > == Example of Controller.py ==
> > from sqlalchemy import *
>
> > engine = create_engine('mysql://user:p...@localhost/exampledb
> > charset=utf8&use_unicode=0')
> > connection = engine.connect()
>
> > result = engine.execute("select field from exampledb")
> > for row in result:
> >        print "name:", row['name']
> > result.close()
>
> > :::Note:::this only prints it to console

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to