Lightweight python wiki engine with pluggable auth system - python

I need to add wiki to my Tornado webapp. i'm new to python so i would like it not too intimidating to be learned and integrated and can use my existing authentication system, hence the lightweight. it would be better if can use mongodb backend.
I already take a look at moin-moin and it seems too complex(?). any other alternative?

Have a look at Hatta. Overwrite WikiRequest.get_author() method to plug your authentication system. But it uses mercurial repository to store the data.

Skeletonz is a very nice lightweight Python cms that might be worth a look...

Related

Suggest a standalone python web framework?

I have a python program that I would like to present as a simple web application. The program currently uses sqlite for storage. I also need to distribute the whole thing to colleagues so having something standalone and easy to start would be ideal ( no install if possible). This web app is meant to be used locally , not by multiple users over a network.
Is there a suitable python framework that might fit my needs? I looked at Django so far but it seems a bit heavy handed for what I need.
Thanks for any suggestions.
I have never tried it myself, but you could try Bottle:
Bottle is a fast, simple and lightweight WSGI micro web-framework for
Python. It is distributed as a single file module and has no
dependencies other than the Python Standard Library.
try http://docs.python.org/library/simplehttpserver.html
As web frameworks are not part of the standard lib, you will have to install something in every case. I would propse to look at http://flask.pocoo.org/. It has a build in WSGI server.
Lots of choices for Python web frameworks! Another is web2py which is designed to work out of the box and allows, but doesn't require, through-the-web development. It is mature and has a strong community and is well-documented.
Tornado as a framework may be a lot more than what you're looking for. However it will meet the requirement of being a completely python based web server. http://tornadoweb.org
I generally just download the source, drop it in /tornado/ of my project and do includes there from the app.
I don't think that any web framework is specifically oriented for the use case you're talking about; They all assume they are running on a server and there's a browser on a remote machine that is accessing them.
A better approach is to think about the HTTP server you'll be using. It's probably preferable to use a server that's as easy to pack and ship as the rest of the python code you'll be using. Now most frameworks provide a 'development' server that's easy to invoke from the command line, but most of them are intended to be "easy for the developer" which often means they are restricted to a single thread. This is bad for deployment because single threaded servers will always feel a bit sluggish.
CherryPy stands out in contrast, by providing a full featured, embedded server that's easy to configure for many use cases, and is available by default with the rest of the framework. There are probably others, but I haven't used 'em.

Python Web Framework with best Mongo support

I'm looking to write a small web app to utilise a dataset I already have stored in a MongoDB collection. I've been writing more Python than other languages lately and would like to broaden my repertoire and write a Python web app.
It seems however that most if not all of the current popular Python web development frameworks favour MySQL and others with no mention given to MongoDB.
I am aware that there are more than likely plugins written to allow Mongo be used with existing frameworks but so far have found little as to documentation that compares and contrasts them.
I was wondering what in people's experience is the Python web development framework with the best MongoDB support?
Many thanks in advance,
Patrick
I have not tried MongoKit although it has been around for a while and retains a good reputation. I personally prefer MongoEngine and feel very comfortable with it (maybe because I like its nice homepage and good documentation). There is also a very good opensource project named Mumblr which demonstrates a Django-MongoEngine-MongoDB combination, which I think a very good starter for any project. I'm developing a CMS for my own company using this app.
I've used MongoKit with Pylons before and it worked out good.
You might want to refer to this post though: MongoDB ORM for Python?
There is no stable support for mongodb using django framework. I tried using mongoengine, but unlike models, provided for admin in django framework, there is no support for mongoengine.
Correct if I am wrong.
Flask is the best framework to use with MongoDB. It has a mongodb library called flask-pymongo
Make sure you run the following commands before starting your project.
$ pip3 install Flask
$ pip3 install Flask-PyMongo

How Ruby's authlogic is compared to Python's repoze.what/who library?

I am trying to understand architecture of authlogic and repoze.what/who libraries but I could get the first level architectural definition. repoze packages seems to use the zope modules at some level..
Are there any equivalent or easier authentication framework like authlogic available in python? (I do not use Django.. I use Pylons)
Anyone has more insight into these libraries?
After a quick look at authlogic's homepage, I would say it can be compared to repoze.who because they both handle authentication. On the other hand, repoze.what handles authorization. For more information, you may want to see this:
http://gustavonarea.net/blog/posts/repoze-auth/
HTH.
PS: Neither repoze.who or repoze.what use Zope (it's the wider Repoze project that is related to Zope). repoze.who uses zope.interface, but that's a Zope-independent library which was born within the Zope project.

Simple python mvc framework

Is there any lightweight mvc webframework which is not necessary to install to the server?
I need something simple, that i could just copy to the shared hosting. And it must handle urls other that localhost/test.py, something like this localhost/Blog/test
You should probably check out Flask or Bottle, two nice Python microframeworks. With an appropriate "main" Python script (to initialize your app and dispatch requests to it) and mod_rewrite rules in place, you can probably get pretty close to your goal of "just copy[ing] to the shared hosting" with nice URLs.
Flask has good documentation on deploying via CGI, which is what you might have to use on your shared host. (If your host supports FastCGI or mod_wsgi, those deployment options would be preferable.)
Checkout web2py. Seems to be about the simplest python based webserver I can think of.
Django might do, it's hefty, but it comes with it's own development server.
web2py includes everything (ssl-enabled web server, sqlite sql based transaction safe database, web based Integrated Development Enviroment, web based database interface) in one package. The web2py binaries for windows and mac also include Python itself. web2py does not require configuration or installation and can run off a usb drive. It was originally developed as a teaching tool for MVC.
checkout https://github.com/salimane/bottle-mvc or https://github.com/salimane/flask-mvc . They are boilerplates that could get you started with controllers, models in separate folders. They are based on bottle and flask micro frameworks, no useless features, they give you the flexibility to plugin whatever modules you want.

Using python to develop web application

I have been doing some work in python, but that was all for stand alone applications. I'm curious to know whether any offshoot of python supports web development?
Would some one also suggest a good tutorial or a website from where I can pick up some of the basics of web development using python?
Now that everyone has said Django, I can add my two cents: I would argue that you might learn more by looking at the different components first, before using Django. For web development with Python, you often want 3 components:
Something that takes care
of the HTTP stuff (e.g.
CherryPy)
A templating language
to create your web pages.
Mako
is very pythonic and works with Cherrpy.
If you get your data from a
database, an ORM comes in handy.
SQLAlchemy
would be an example.
All the links above have good tutorials. For many real-world use-cases, Django will be a better solution than such a stack as it seamlessly integrates this functionality (and more). And if you need a CMS, Django is your best bet short of Zope. Nevertheless, to get a good grasp of what's going on, a stack of loosely coupled programs might be better. Django hides a lot of the details.
Edited 3 years later: Don't use mod_python, use mod_wsgi. Flask and Werkzeug are good frameworks too. Needing to know what's going on is useful, but it isn't a requirement. That would be stupid.
Don't lookup Django until you have a good grasp of what Django is doing on your behalf. for you. Write some basic apps using mod_python and it's request object. I just started learning Python for web-development using mod_python and it has been great.
mod_python also uses a dispatcher in site-packages/mod_python/publisher.py. Have a ganders through this to see how requests can be handled in a simple-ish way.
You may need to add a bit of config to your Apache config file to get mod_python up and running but the mod_python site explains it well.
<Directory /path/to/python/files>
AddHandler mod_python .py
PythonHandler mod_python.publisher
PythonDebug On
</Directory>
And you are away!
use (as a stupidly basic example):
def foo(req):
req.write("Hello World")
in /path/to/python/files/bar.py assuming /path/to is your site root.
And then you can do
http://www.mysite.com/python/files/bar/foo
to see "Hello World". Also, something that tripped me up is the dispatcher uses a lame method to work out the content-type, so to force HTML use:
req.content_type = 'text/html'
Good Luck
After you have a good idea of how Python interacts with mod_python and Apache, then use a framework that does all the boring stuff for you. Up to you though, just my recommendation
If you really don't want to delve into the frameworks - and you should, I heartily recommend Django or Pylons - there's still need to go down the road of CGI. This is a totally out-of-date technology, not to mention slow and inefficient.
There is a standard way of building Python web applications, and it's called WSGI. If you want to roll your own web app from scratch, this is absolutely the way to go.
That said, if you're just starting out, really you should go with one of the frameworks.
Python Wiki: Web Frameworks for Python
If you decide to use Django, the official tutorial is an excellent place to start. The Django Book is also free.
There are a couple of choices for web development. From my experience, your choice will again be dependent on your application. I used django and web.py in production and I am about to deploy an app based on pylons.
Django hides a lot of choices (comes with its ORM and templating). The documentation is extensive and well-written. There are many reusable app available for django, but you will likely to invest a little time in integrating them seamlessly. One thing mentioned on djangocon 08 was the fact, that there is cool stuff in django, which can't be easily
accessed in non-django projects.
web.py impressed me by its raw simplicity. Before I knew it, I wrote a small app (78 lines quasi-wiki) in it.
pylons feels like in the middle of both. I can use sqlalchemy and jinja, all in all a pleasant experience for the start.
Lookup Django.
Python can be used for web development, but there isn't a special language extension or anything in the language that will handle all the HTML generation or that works like PHP.
It's pretty much run through some sort of interpreter on a web server (CGI, mod_python, etc.).
I would recommend looking into Python Web Application Frameworks or how to write Python CGI scripts.
There are quite a few web frameworks for python out there, but the only one I've used is Django, and I really like it.
If you've got a few hours, do the tutorial, I promise you, you'll enjoy it :)
As others have mentioned, one of the more prominent python "offshoots" as you call them would be Django. It is a rather powerful framework that allows you to quickly and securely build web applications. The first place to look would be their overview which gives some insight as to what Django does as a framework.
Going through their tutorial taught me alot about the prominent Model-View-Controler design pattern and how it may be used in a web-development context. I found it a great way to start writing an application that worked and learn by improving it.

Categories