Django development version vs stable release - python

I am about to start ramping up on Django and develop a web app that I want to deploy on Google App Engine. I learn that Google has Django 0.96 already installed on the APP engine, but the latest "official" version of Django I see is at 1.2.3 and its a bit of an effort to install it there.
I am curious which version of Django is most widely used.
So, can you please guide me on which Django version I should ramp on and deploy based on the following criterion
Stability and suitability for production release
Availability for applications (or plugins) and which version is most supported by the community
Thanks a lot!

Most people are currently using Django 1.2. You should not use or learn Django .96 - it's VERY old, and learning to use it won't prepare you for any non-app-engine Django work since things have changed significantly since then.
Django on App Engine is something of a pain, since you lose a lot of the ORM, which is a really nice reason to be working with Django. You also lose the ability to simply drop-in plugins and reusable apps that use any of the Django ORM. Anything with a models.py won't work.
Take a look at google-app-engine-django for help getting a more recent version running.
http://code.google.com/p/google-app-engine-django/
There is work to integrate the GAE storage engine into Django, and several projects have variously working implementations, but I wouldn't expect really good ORM support for a while yet - 1.3 (which is still several months from release) will include hooks that make it easier to write NoSQL backends, but Django probably won't ship with one.
While there are security releases for old versions of Django, you should really be developing using the latest stable version. Major releases of Django have a very strong backwards compatibility promise, so going from 1.2 to 1.3 when it comes out will be pretty seamless.
I strongly encourage you to think long and hard about what precisely App Engine offers your specific application before spending a lot of energy getting things working there. You lose application portability, scaling is still hard, and you don't save money if your application gets popular. App Engine is not a forgiving introductory platform.
For more conversation on this topic, take a look at this question:
Why use Django on Google App Engine?
particularly my answer there and the comments on it.

app engine permits you to use other versions of django out of the box, with only a little pain, using google.appengine.dist.use_library. essentially, your main.py (the module specified by app.yaml to handle urls) should look like this:
import wsgiref.handlers
from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
from google.appengine.dist import use_library # important bit
use_library('django', '1.1')
import django.core.handlers.wsgi
def main():
application = django.core.handlers.wsgi.WSGIHandler()
# Run the WSGI CGI handler with that application.
webapp.util.run_wsgi_app(application)
if __name__ == '__main__':
main()

Another thing to consider is how you install. I'd be sure to install django from SVN, because it makes updating it MUCH easier.
I have been using the dev version for a while on my site, and haven't encountered a single bug yet, aside from one that affected the admin site in a minor way (which a svn up fixed).
I don't have a feel for whether people are using 1.2 or dev, but in my experience, dev is perfectly suitable. Any major errors that you may have in the code will get fixed very quickly, and svn up will get you to the latest code on the off chance that you get a revision with a major bug.

Related

Install Django apps through the Django admin-site like plugins in Wordpress

I want to implement a module-manager in Django where third-party modules can be installed through the django admin interface (without changing the code-base of the main project). Or it could also be a service that runs on top of django.
These modules should have the same capabilities as a django app. For example, defining models and views, making migrations, and interacting with other apps. Similar to how it works with the plugin-manager of Wordpress.
Is there a good way to do this? (and are there reasons why I should not?)
What is a Django app? According to Django Packages
Small components used to build projects. An app is anything that is installed by placing in settings.INSTALLED_APPS.
Generally speaking, here are the steps to have an app working in Django
Install the app
pip install app
Register the app in one's settings.py
INSTALLED_APPS = [
...
'app',
...
]
In some cases they'll require to sync the database. Such is the case with social-auth-app-django. Here you'd have to do as well
python manage.py migrate
In some other cases they require specific versions of Python, Django, ect, so that'd have to be taken in consideration too. Such is the case with Django REST framework which requires
Python 3.6+
Django 4.1, 4.0, 3.2, 3.1, 3.0
It's possible as well that apps are dependent on certain Python libraries. Then, one would have to install them too.
For a basic version of that, one wants to create a place to have a button to install an app as well as a model to store the app. The model will keeps track of specific variations with BooleanField.
More precisely, since we now know some apps require database sync, the app model will have requires_db_sync = BooleanField(default=False). Then, if that's true, when installing that app one will want to run at least steps 1, 2 and 3.
One will eventually want to do a thorough analysis of the existing apps and understand the different possible variations (dependencies, requiring DB sync, etc).
I work with WordPress too and this was a thought that came to my mind a few years ago. I didn't pursue it because for most apps I still had to go to the code and do various configurations.
To deal with that, WordPress plugins, like WPForms, come with pages where one does that configuration.
Since such Django app configuration pages for configuration don't yet exist, they'd have to be created as well.
Also, would be great to have a trusted agency with standards to validate an app as good to be in that system.

Will Robohash run as a python app at App Engine?

We have a need for Robohashes that never change and are very secure and reliable. This is perfect for a Google app where it can be monitored, run over SSL and be extremely reliable.
I really don't have much python experience. Would someone please give a mile-high view? Would it be easy to host Robohash as a python app at the App Engine?
requirements.txt
pillow <- not supported
tornado <- looks like it will work
Are there other challenges, like say how files are accessed? Java in the appengine couldn't not read the file system last I checked it had to use resources. Do you think it will be worth-while for me to pursue?
This is the version we need: https://github.com/BitShares/Robohash
I'm afraid that won't work directly as an application deployed to the standard Google App Engine (GAE) runtime.
There is a way to add third party modules to your GAE app, and it would probably work with pillow, but not with Tornado as it would collide with the webapp2 web framework used by GAE.
Having said that, there are good news for you.
You could use Managed VMs that are in the middle of deploying only your application and of having your own virtual instance where you install everything.
With managed VMs you could build your custom runtime with exactly what you need.

GAE webapp alternative working outside of GAE environment

I like working with GAE environment as well as with its webapp framework. I am creating a web application using GAE environment. What I think about is how to create a version of my application that could run in another environment, like some other hosting or cloud service the easiest way. I know I will have to think about database storage alternative too and some other features that GAE gives and is not available on another platform out of the box. But now I wonder just about webapp framework. So, what can I use as alternative to this in GAE? May be some existing framework that is as much as possible close to GAE webapp? I know it is using webob, may be somebody has already implemented this alternative? Please give me some advice. Thanks!
The pre-release version of Tipfy is adding the ability to be used outside of App Engine.
Also, you might want to consider instead of finding a web framework that works in multiple environments, try out a way to run App Engine apps in other environments with something like AppScale, or TyphoonAE.
Have a look to web2py, in my opinion it's a great and well documented web framework and it offers a powerful Dal that allows your application to be portable among different types of database, GAE datastore included *.
* with some limitation explained here
I would look at Pyramid. Running Pyramid on Google App Engine
Like you mentioned, SQLAlchemy doesn't work on GAE and you won't be able to use the same data storage routines. Depending on what you are doing, you could design your application so that most everything else would be interchangeable.
Another option would be Django-nonrel. It's a version of Django that will work on app engine and is designed to make it easy to port your code from app engine to other platforms.
Running Pure Django Projects on Google App Engine
I've written a couple GAE applications, and have come to feel that Django Nonrel is a little too heavy for my tastes. I really like the ease-of-use of Flask, and I'd expect you'd feel the same way — especially for simple apps.
Here's one GAE Flask skeleton.
Here's another.
You could also check out tipfy.
There are a few projects thats are working on replicating the GAE environment:
Typhoon AE
App Scale
I have not personally used either of these but I think that would be the best place to get started.
You should check out Series about using Google App Engine with some Python web frameworks by franciscosouza

Django + GAE (Google App Engine) : most convenient path for a beginner?

Some background info first:
Goal: a medium-level complexity web app that I will need to maintain and possibly extend for a few years.
Experience: good knowledge of python, some experience of MVC frameworks (in PHP).
Desiderata: using django and google app engine.
I read extensively about the compatibility issues between GAE and Django, and I am aware of the GAE patch, the norel project, and other similar pieces of code. I have also understood that the SDK provides some of the features of django "out of the box".
Yet, given that I have no previous experience with neither Django nor GAE, I am unable to evaluate to which extent using a patched version of Django will strip away important features, or how far the framework provided in the SDK is compatible with Django. So I am rather confused on what would be the best way to proceed in my situation:
Should I simply use a patched version of Django as the differences with the original Django are so minor that I would hardly notice them?
Should I write my app completely in "regular django" and try to port it to GAE only afterwards, when I will have got a grasp on Django internals and philosophy?
Should I write my app using the framework provided with the SDK and port it to django only afterwards?
Should I... ?
Thank you in advance for your time and advice.
I'm not sure if Django is a good fit for you. Django is a great framework for standalone applications because it provides a full stack solution: an ORM, authentication system and an admin interface, to name a few. You won't be able to use any of these on App Engine. Furthermore, many of the code samples are geared towards using the built in Webapp framework - you can very easily set cache expiration and authentication settings in app.yaml for configuration.
I see one of two paths for you:
Learn App Engine with Webapp. There's enough to learn about using the datastore and App Engine's services that'll keep you busy.
Learn Django off App Engine. You'll learn a lot about using Django's ORM, Admin goodies, URL routing, Forms and templates
By trying to learn both at the same time, you'll spend more time than you need learning the nuances of Django/GAE compatibility, time you could be spending either learning Django or GAE.

Python Webframework Confusion

Could someone please explain to me how the current python webframworks fit together?
The three I've heard of are CherryPy, TurboGears and Pylons. However I'm confused because TurboGears seems to use CherryPy as the 'Controller' (although isn't CherryPy a framework in in it's own right?), and TurbGears 2 is going to be built on top of Pylons (which I thought did the same thing?).
There are more to it ofcourse.
Here's a comprehensive list and details!
Web Frameworks for Python
Extract from above link:
Popular Full-Stack Frameworks
A web application may use a
combination of a base HTTP application
server, a storage mechanism such as a
database, a template engine, a request
dispatcher, an authentication module
and an AJAX toolkit. These can be
individual components or be provided
together in a high-level framework.
These are the most popular high-level
frameworks. Many of them include
components listed on the WebComponents
page.
Django (1.0 Released 2008-09-03) a
high-level Python Web framework that
encourages rapid development and
clean, pragmatic design
Pylons (0.9.6.2 Released 2008-05-28) a
lightweight Web framework emphasizing
flexibility and rapid development. It
combines the very best ideas from the
worlds of Ruby, Python and Perl,
providing a structured but extremely
flexible Python Web framework. It's
also one of the first projects to
leverage the emerging WSGI standard,
which allows extensive re-use and
flexibility but only if you need it.
Out of the box, Pylons aims to make
Web development fast, flexible and
easy. Pylons is built on top of Paste
(see below).
TurboGears (1.0.4.4 Released
2008-03-07) the rapid Web development
megaframework you've been looking for.
Combines CherryPy, Kid, SQLObject and
MochiKit. After reviewing the website
check out: QuickStart Manual
web2py (currently version 1.43)
Everything in one package with no
dependencies. Development, deployment,
debugging, testing, database
administration and maintenance of
applications can be done via the
provided web interface. web2py has no
configuration files, requires no
installation, can run off a USB drive.
web2py uses Python for the Model, the
Views and the Controllers, has a
built-in ticketing system to manage
errors, an internationalization
engine, works with MySQL, PostgreSQL,
SQLite , Oracle, MSSQL and the Google
App Engine via an ORM abstraction
layer. web2py includes libraries to
handle HTML/XML, RSS, ATOM, CSV, RTF,
JSON, AJAX, XMLRPC, WIKI markup.
Production ready, capable of
upload/download of very large files,
and always backward compatible.
Grok (0.13 Released 2008-06-23) is
built on the existing Zope 3
libraries, but aims to provide an
easier learning curve and a more agile
development experience. It does this
by placing an emphasis on convention
over configuration and DRY (Don't
Repeat Yourself).
Zope (2.10.4 Released 2007-07-04,
3.3.1 Released 2007-01-14, Zope 3.4.0c1 Released 2008-01-31) Being the grandaddy of Python web frameworks,
Zope has grown into a family of
frameworks over the years. Zope 1 was
released in 1999. Zope 2 is both a web
framework and a general purpose
application server, today it is
primarily used by
ContentManagementSystems. Zope 3 is
both a standalone framework and a
collection of related libraries, which
are also included with newer releases
of Zope 2. All of the Zope frameworks
include the ZODB, an object database
for Python.
Give a try to web2py. It is point and click (you do not even need to install Python, comes with it). You develop using a web interface and you can deploy almost everywhere, including iPhone, Oracle and Google App Engine. Before trying web2py, try install some of the other Python frameworks, you will appreciate it even more.
CherryPy is not a full-stack web framework (like Django for example), in fact it isn't a web framework but a HTTP framework. Writing a web application using CherryPy is much like writing a regular object-oriented application in Python.
Also, CherryPy has it's own production-ready WSGI web server, which can be also used for applications written using other frameworks, hence the confusion surrounding CherryPy as a framework.
If you are looking for a start-to-finish solution then it's worth mentioning that the leader of the pack in that space is Django
Have you tried FastAPI.
It's a is a modern, fast (high-performance), web framework for building APIs with Python 3.6+ based on standard Python type hints.
Pretty easy to learn, quite powerful and lightweight.
https://fastapi.tiangolo.com/
I have been using for my application and it seems to be similar to Flask, but quite robust.
from fastapi import FastAPI
app = FastAPI()
#app.get("/")
def read_root():
return {"Hello": "World"}
Some Video Tutorials can be found here
You can also find a lot of help materials from here

Categories

Resources