After spending lots more time wondering why I couldn't find anything beyond 'Hello World' in the WSGI tutorials, I decided to look into a smaller framework and found flask : http://flask.pocoo.org/
I got this up and running in no time and it seems as this excellent tutorial : http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world Can take me the rest of the way ... For the few people who replied, Thank you, and I appreciate the assistance. I realize my requirements said 'no framework' but I really didn't know what I needed. ... I'm used to making my simplistic webpages with not much more than a text editor .. however, this framework seems to do things that I wouldn't want to do by hand without the overkill or extra features (not always a bad thing) of django or web2py . (Not looking to start a debate) Thanks again. On Saturday, April 13, 2013 3:04:40 PM UTC-4, Anthony wrote: > > Can someone help me catch my first fish? > > In years past, I've developed a simple web applications using IIS, a text > editor, and Classic ASP/VBScript, it can pull data from a SQL DB (via ODBC) > and has basic web forms and multiple html pages for users to pull data from > the database etc... worked well and for what I need and, for the most part, > I understand how it works. > > However, I now want to update myself. I've done a bit of python for text > parsing, network administration scripts (Thank you Paramiko) and various > other related things and really like it better than other scripting > languages I've dabbled in. I'd like to now design a completely different > website (probably 20-40 different html pages) used privately (Perhaps > utilizing some items from my current MSSQL DB) and would like to do this in > Apache and Python using mod_wsgi I believe (moving away from IIS/MS).. > Nothing too fancy, as design and colors aren't important. (This site is to > be used to display dynamic content pulled from databases relevant to a > network administrator) > > I'd like to stay away from a framework for a few reasons (That I'm not > sure are good ones): Less complexity, better understanding of what's going > on, and no extra parts force-fed to me (The bit I've touched of Django I > felt a bit like cattle following a line ... forcing me to choose a DB and > admin usernames/pwds where I wasn't even sure how or why I would want to > use it instead of just doing the legwork myself). > > I'm getting stuck as follows (and it's a bit difficult to describe), It > relates to having my entire website run as an 'application' and really > making the leap from the hello world app, to a website broken up between > multiple (in the past) .asp pages, to the equivalent with mod_wsgi / python. > > Following most of : https://code.google.com/p/modwsgi/ I can get the > Hello world application to work in daemon mode, and now I feel I'm ready to > expand, but how? I'm used to (w/asp or legacy cgi) each individual page > being loaded w/each GET/POST request and the page determining what to do > (post to a form, display some content from a DB etc..) but does this mean > I need a separate application for each web 'page? I can list a few bullet > questions as follows : > > - How does this scale out if even to just a few more html/css pages? > I assume I have to start thinking differently than traditional .cgi or > .asp. > - On these subsequent pages, how can I include additional pages (menu > header or css for example) something like > open("/path/to/header.BBB?menu=reporting") > (I put BBB as I have no clue what extentsions these files would typically > have) > - How are html links and images local to the site typically done? A > question so trivial I'm a bit embarrassed but I'm just trying to walk > here... > - Typically are separate 'WSGI apps' for each and every page how > people handle this? (Not trying to steer anyone in this direction) > - I am probably missing a tutorial page (something between the install > guide and developer guidelines above), but I need to bridge this gap, can > someone send me a link? > - How would the directory tree typically be laid out (I realize this > is personal preference, but... if for example, I saw a template it could > go > far towards helping me understand the big picture? > - I realize extentions do not matter really but can someone help me > understand which ones are typically used? (All pages .wsgi, py, html, css > etc?) > - Having to sudo to root on each webpage is a pain, so I know i have > some permission issues so if anyone has recommendations on how to allow a > group/user to edit feel free to assist. > > There's probably a better way to paste some code into this group, however, > perhaps it's best to ask my question in this format, here's what I've done > (barely scratched the surface): > [root@mywebserver wsgi-scripts]# cat /etc/httpd/conf.d/mysite.conf > <VirtualHost *:80> > ServerName mywebserver.myhouse > DocumentRoot /var/www/www > > WSGIDaemonProcess mywebserver.myhouse processes=2 threads=15 > display-name=%{GROUP} > WSGIProcessGroup mywebserver.myhouse > > WSGIScriptAlias / /var/www/www/wsgi-scripts/startapp.wsgi > > <Directory /var/www/www/wsgi-scripts> > Order allow,deny > Allow from all > </Directory> > </VirtualHost> > [root@mywebserver wsgi-scripts]# cat > /var/www/www/wsgi-scripts/startapp.wsgi > def application(environ, start_response): > status = '200 OK' > if not environ['mod_wsgi.process_group']: > output = 'EMBEDDED MODE' > else: > output = 'DAEMON MODE Cool huh, now I do not have to reload apache > each time, but now I have so many more questions! What next?' > > response_headers = [('Content-Type', 'text/plain'), > ('Content-Length', str(len(output)))] > start_response(status, response_headers) > return [output] > [root@mywebserver wsgi-scripts]# ls -l > /var/www/www/wsgi-scripts/startapp.wsgi > total 4 > -rw-r--r--. 1 root root 375 Apr 13 13:02 startapp.wsgi > > -- You received this message because you are subscribed to the Google Groups "modwsgi" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/modwsgi?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
