On Tue, Aug 14, 2012 at 6:39 PM, Gery <geryherb...@gmail.com> wrote:
>
>
> Hello Simon,
>
> Thanks for your answer, acttually I don't use any web framework, I just did
> a html page and put Openlayers, GeoExt, and Ext code there. To display
> points/lines/polylines/rasters/etc., I use Mapserver, so I connect my
> PostGis database with OpenLayers. After putting the
> http://localhost/mop/py/dbmodel.py link, I get the whole model (I think this
> should be my model, is it right?), so the Apache works well =):
>
> #created: 30 July 2012
> #updated: 12 August 2012
> #Gery
>
> from sqlalchemy import *
> from sqlachemy import create_engine, MetaData, Table
> from sqlalchemy.orm import *
> from sqlalchemy.orm import mapper, relation, backref, sessionmaker
> from sqlalchemy.ext.declarative import declarative_base
>
> # Setup the url, database engine and session
> url = 'postgresql://postgres:password@localhost:5432/mop'
> engine = create_engine(url, echo=True)
> session = sessionmaker(bind=engine)
> session = Session()
>
> # Setup the declarative extension and metadata
> Base = declarative_base(metadata=metadata)
> metadata = MetaData(engine)
>
> # Define the model classes
> class Boreholes(Base):
>       __tablename__ = 'boreholes_point_wgs84'
>       __table_args__ = {'autoload':True}
>
> # DDL Extensions for geometry specific DDL
> GeometryDDL(Boreholes.__table__)
>
>
> Do I really need a web framework? I know some people use GeoAlchemy and
> SqlAlchemy with Pylons, but I don't want to use that, well in general any
> web framework. What could it be that "something" you mentioned that I need?
> I've been reading that with PHP I can make the connection to do the HTTP
> requests/responds, am I right? is this the unique way or solution to do
> this?
>
> Thanks again
>
>

Hi Gery,

At the moment, your javascript code (running in your web browser) is
making an HTTP request to Apache. Apache is simply returning the
contents of the requested file, so your javascript is receiving a
string of Python code that it has no way of interpreting. I'm afraid
this will never work.

What you need is for Apache to *execute* the python script and return
the contents to your browser. There are lots of ways of doing this,
but you'll really need to at least have a basic understanding of web
technologies. You will have to understand how OpenLayers requests data
from the server, know how to extract query parameters from the
request, turn those into a database query, format the results as JSON
and return them back to the browser. I'm afraid all of those things
are outside the scope of this list.

Sorry I can't be more help,

Simon

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to