Python / Apache / MySQL

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • vpr

    #1

    Python / Apache / MySQL

    Hi All

    I want to build an Website using Apache / Python and MySQL.
    I dont want to spend to much time hacking html. I'm looking for some
    recommendations
    e.g. should I be using mod_python ?
    whats the best module for mysql ?

    any suggestings so I could get my site up in a day ?

    mvanaswegen@gma il.com

  • bruno at modulix

    #2
    Re: Python / Apache / MySQL

    vpr wrote:[color=blue]
    > Hi All
    >
    > I want to build an Website using Apache / Python and MySQL.[/color]

    Good choice, good choice, bad choice...
    Why not using PostgresSQL (if you need a *real* RDBMS) or SQLite (if you
    don't...)
    [color=blue]
    > I dont want to spend to much time hacking html. I'm looking for some
    > recommendations
    > e.g. should I be using mod_python ?[/color]

    mod_python is mostly a 'low-level' Apache API binding. Better use a
    higher-level tool on top of it. AFAICT, Myghty might be of some help here.
    [color=blue]
    > whats the best module for mysql ?[/color]

    Psycopg ?-)

    oops, sorry....
    [color=blue]
    > any suggestings so I could get my site up in a day ?[/color]

    Look for Myghty, Pylons (built on Mygthy), or Django. There's also
    Turbogears, but it's based on CherryPy, so you won't really take
    advantage of mod_python's Apache integration.



    --
    bruno desthuilliers
    python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
    p in 'onurb@xiludom. gro'.split('@')])"

    Comment

    • Sybren Stuvel

      #3
      Re: Python / Apache / MySQL

      vpr enlightened us with:[color=blue]
      > I want to build an Website using Apache / Python and MySQL.[/color]

      I second Bruno: swap MySQL in favour of PostgreSQL.
      [color=blue]
      > e.g. should I be using mod_python ?[/color]

      You could use my framework based on mod_python and Cheetah. I find it
      really easy to use. Check out http://www.unrealtower.org/webengine
      [color=blue]
      > whats the best module for mysql ?[/color]

      I'd use SQLObject. It can handle MySQL (if you really want to stick to
      it), SQLite and PostgreSQL.

      Sybren
      --
      The problem with the world is stupidity. Not saying there should be a
      capital punishment for stupidity, but why don't we just take the
      safety labels off of everything and let the problem solve itself?
      Frank Zappa

      Comment

      • Kalle Anke

        #4
        Re: Python / Apache / MySQL

        On Tue, 14 Feb 2006 10:32:34 +0100, Sybren Stuvel wrote
        (in article <slrndv38ti.7rh .sybrenUSE@schu imige.unrealtow er.org>):
        [color=blue]
        > I second Bruno: swap MySQL in favour of PostgreSQL.[/color]

        And the reason is ?? (apart from PostgreSQL being larger and more complete,
        what are the differences for "simple" usage?)

        jem

        Comment

        • bruno at modulix

          #5
          Re: Python / Apache / MySQL

          Kalle Anke wrote:[color=blue]
          > On Tue, 14 Feb 2006 10:32:34 +0100, Sybren Stuvel wrote
          > (in article <slrndv38ti.7rh .sybrenUSE@schu imige.unrealtow er.org>):
          >
          >[color=green]
          >>I second Bruno: swap MySQL in favour of PostgreSQL.[/color]
          >
          >
          > And the reason is ?? (apart from PostgreSQL being larger and more complete,
          > what are the differences for "simple" usage?)[/color]

          The reason is mostly that either you need a real, full-blown, rock-solid
          RDBMS - which MySQL is definitively not - or you dont - in which case
          SQLite is probably a much more lightweight and agile solution.

          My 2 cents
          --
          bruno desthuilliers
          python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
          p in 'onurb@xiludom. gro'.split('@')])"

          Comment

          • Kalle Anke

            #6
            Re: Python / Apache / MySQL

            On Tue, 14 Feb 2006 11:19:11 +0100, bruno at modulix wrote
            (in article <43f1aebb$0$172 8$636a55ce@news .free.fr>):
            [color=blue]
            > The reason is mostly that either you need a real, full-blown, rock-solid
            > RDBMS - which MySQL is definitively not - or you dont - in which case
            > SQLite is probably a much more lightweight and agile solution.[/color]


            Stupid questions (I know very little about databases):

            I always thought that a SQLlite database "belonged" to a single process, can
            a database be used by several processes?

            Let's say I would build a small web application that would be used by a small
            number of people/processes and it wouldn't be anything fancy just basic
            "selects". What would be the choice for this?

            What about speed? I've always had the impression that while PostgreSQL is
            more complete than MySQL it's also slower.

            Sorry, if these are really stupid questions but ...

            jem

            Comment

            • Peter Hansen

              #7
              Re: Python / Apache / MySQL

              Kalle Anke wrote:[color=blue]
              > I always thought that a SQLlite database "belonged" to a single process, can
              > a database be used by several processes?[/color]

              Depending on what you mean by "belong", that's either true or false.
              Certainly multiple processes can access a SQLite database, although as
              the documentation clearly describes if those processes are making
              _frequent updates_ it's not the best solution and another database might
              be more suitable.
              [color=blue]
              > Let's say I would build a small web application that would be used by a small
              > number of people/processes and it wouldn't be anything fancy just basic
              > "selects". What would be the choice for this?[/color]

              SQLite. (As but one option, but "just basic selects" is certainly
              included in the set of suitable conditions for SQLite use.)
              [color=blue]
              > What about speed? I've always had the impression that while PostgreSQL is
              > more complete than MySQL it's also slower.[/color]

              Don't optimize prematurely? If you use something like SQLObject, or any
              other means of abstracting yourself away from the details of a specific
              datbase, you won't be particularly tied to it if you decide you need
              improved performance, or sophistication, or whatever.
              [color=blue]
              > Sorry, if these are really stupid questions but ...[/color]

              They're not.

              Comment

              • Sybren Stuvel

                #8
                Re: Python / Apache / MySQL

                Kalle Anke enlightened us with:[color=blue]
                > What about speed? I've always had the impression that while
                > PostgreSQL is more complete than MySQL it's also slower.[/color]

                For simple queries, I believe (no real knowledge here) MySQL is indeed
                faster. One of the problems I have with MySQL is that it doesn't
                support foreign keys nor transactions on the default table format.

                Sybren
                --
                The problem with the world is stupidity. Not saying there should be a
                capital punishment for stupidity, but why don't we just take the
                safety labels off of everything and let the problem solve itself?
                Frank Zappa

                Comment

                • Kalle Anke

                  #9
                  Re: Python / Apache / MySQL

                  On Tue, 14 Feb 2006 12:04:45 +0100, Peter Hansen wrote
                  (in article <mailman.1893.1 139915116.27775 .python-list@python.org >):
                  [color=blue]
                  > SQLite. (As but one option, but "just basic selects" is certainly
                  > included in the set of suitable conditions for SQLite use.)[/color]

                  I've considered to use SQLite for an application but for completely different
                  reasons ... hmm, I should perhaps consider SQLite for some other ideas I have
                  also ...
                  [color=blue]
                  > Don't optimize prematurely? If you use something like SQLObject, or any
                  > other means of abstracting yourself away from the details of a specific
                  > datbase, you won't be particularly tied to it if you decide you need
                  > improved performance, or sophistication, or whatever.[/color]


                  That's true ... I was thinking in general terms here (a couple of people I
                  know handles huge data sets, genome data type of things, and in their case
                  speed is very important)

                  Comment

                  • Luis M. González

                    #10
                    Re: Python / Apache / MySQL

                    Just a few comments...

                    Database:
                    As with anything else, try to keep it simple until you need to make it
                    complex.
                    Sqlite is the simplier alternative, and it's also the fastest for the
                    intended use (small number of users, simple selects, etc). MySQL is
                    also a very good alternative and much more powerful.

                    Mod_python:
                    Mod_python is the best choice (AFAIK, please correct me if I'm wrong)
                    if you want speed, performance and scalability. Many frameworks are
                    based on mod_python (Django, for example), so you can't go wrong with
                    it.
                    But let me tell you that if you just want to use bare-bones mod_python,
                    without any framework on top of it, you can do it, and it's not
                    difficult at all.
                    Mod_python comes with its own implementation of PSP (python server
                    pages), which lets you program a la PHP (intermingling python and
                    html).
                    If you want, you can also separate logic and presentation by using its
                    "publisher handle" along with PSP templates. If you prefer other kinds
                    of templetaing system, you can use them too (for example Cheetah).

                    For a long time I steered away of mod_python because I had the
                    impression it was too difficult and not user friendly enough, what once
                    I tried and followed the examples in the documentation, I found it to
                    be a very good alternative.
                    And the community on its mailing list is very kind and supportive. They
                    reply any question in a matter of minutes.

                    Comment

                    • Peter Hansen

                      #11
                      Re: Python / Apache / MySQL

                      Kalle Anke wrote:[color=blue]
                      > On Tue, 14 Feb 2006 12:04:45 +0100, Peter Hansen wrote:[color=green]
                      >>Don't optimize prematurely? If you use something like SQLObject, or any
                      >>other means of abstracting yourself away from the details of a specific
                      >>datbase, you won't be particularly tied to it if you decide you need
                      >>improved performance, or sophistication, or whatever.[/color]
                      >
                      > That's true ... I was thinking in general terms here (a couple of people I
                      > know handles huge data sets, genome data type of things, and in their case
                      > speed is very important)[/color]

                      There is information about SQLite speed starting here
                      http://www.sqlite.org/speed.html (where it notes that that particular
                      page is obsolete, but also points to the wiki for more).

                      The summary would appear to be that SQLite is definitely faster in some
                      cases, definitely slower in others, and that as usual a measurement of
                      inadequate speed followed by profiling is essential to knowing what to
                      do about any of that. :-)

                      -Peter

                      Comment

                      • Sybren Stuvel

                        #12
                        Re: Python / Apache / MySQL

                        Dennis Lee Bieber enlightened us with:[color=blue]
                        > I believe that since 4.1, the "default table format" is InnoDB, and
                        > that DOES have some support foreign keys and transactions.[/color]

                        Finally they are starting to make more sense. I'd still rather use a
                        database that has had those features for a longer time, though.

                        Sybren
                        --
                        The problem with the world is stupidity. Not saying there should be a
                        capital punishment for stupidity, but why don't we just take the
                        safety labels off of everything and let the problem solve itself?
                        Frank Zappa

                        Comment

                        • Paul Boddie

                          #13
                          Re: Python / Apache / MySQL

                          Sybren Stuvel wrote:[color=blue]
                          > Dennis Lee Bieber enlightened us with:[color=green]
                          > > I believe that since 4.1, the "default table format" is InnoDB, and
                          > > that DOES have some support foreign keys and transactions.[/color]
                          >
                          > Finally they are starting to make more sense. I'd still rather use a
                          > database that has had those features for a longer time, though.[/color]

                          My experience with MySQL on the abomination that is Fedora Core (so I
                          imagine it was 4.x as opposed to 5.x), was that the default table type
                          appeared to be the ridiculously incapable MyISAM, and that by choosing
                          InnoDB you got transactions along with a bunch of limitations and a
                          serving of odd behaviour, where "odd" means "would raise a laugh
                          amongst users of other database systems".

                          I think you only really need to compare the manuals for MySQL [1] and
                          PostgreSQL [2] to see that PostgreSQL offers straightforward but
                          seemingly well-tested functionality for populating databases and then
                          having them just work properly, whereas MySQL offloads an array of
                          "features" and a mangled SQL syntax onto the developer/administrator in
                          a way that would suggest, if one were to be uncharitable in this
                          matter, that the developers of MySQL aren't confident that everything
                          works and would rather "empower" users to make their own choices and
                          then to apologise for themselves when something they thought might work
                          (and probably would on some other system) actually doesn't.

                          Anyway, various comparisons have been made, and here are a few
                          good/recent ones:





                          And here's one with a Pythonic slant:



                          Paul

                          [1] http://dev.mysql.com/doc/refman/5.0/en/
                          [2] http://www.postgresql.org/docs/7.4/static/

                          Comment

                          Working...