What's a good open source django project to learn from? - django

What is a good django open source app that I can learn from? Something that follows best practices, and covers the majority of features and isn't overly complicated?

This would depend on your current level of knowledge of python and django.
If you are just starting to use django, I suggest you take a look in django documentation. It is well specified and clear. If you have some project in mind, start working on it while looking up for best practices about specific parts. For python coding style try to follow the pep 8 style guide.
If you already have done some work with django there are many sites lie these:
http://djangopackages.com/categories/apps/
http://www.django-apps.com/
What I do nowdays is look into django contrib apps (admin, auth, comments, flatpages), which are built based on the rest of django. This gives the best ways on how to write my apps.
Following the django comments framework (object independent), I am working on an app django-valuate (object independent attachment of ratings, likebuttons etc. through template tags)
These are some of my views. I have also starred this question, as I would like to know about some different perspectives and if mine are sound.

I've found djangobb (www.djangobb.org) to be a complete application, production quality and relatively simple. I use it as a base for my application which has nothing to do with forums and bb.
cloc output: only 3000 lines of python code in 30 files, another 2900 lines of templates html

I do not think there would be any one specific app that would cover all/most features of Django since the concept of the Django app itself is to perform specific/related functionality.
Having said that, a popular Django app is django-registration. Its popularity stems from the obvious requirement of most webapps to have User authentication and also its extremely easy to integrate with a Django project.
The best approach perhaps would be to keep trying the tons of open source Django apps available on the net. You can browse through http://www.djangopackages.com/ and http://www.django-apps.com/ to start getting your hands dirty.

snipt.net, a code sharing site:
https://github.com/lionburger/snipt
Review Board, a code review web app
https://github.com/reviewboard/reviewboard/tree/master/reviewboard
rietveld, another code review on app engine, by GVR himself. You need to know a bit of Django before digging into this source code since the Django models don't work on App Engine, GAE db model is used instead.
http://code.google.com/p/rietveld/source/browse/#svn%2Ftrunk

Related

Integrating django apps in your own views

Let's say I'm writing a complex site in django with wikis, forums, ... or writing my own apps that I intend to reuse from different sites.
I really want to create, for example, a wiki page that has a forum at the bottom, or reuse my previously written wiki app with a different graphical layout.
What is the best way to structure my app to allow this kind of reuse?
So far, I have been giving apps their own urls in urls.py. This however does not work if I want to combine multiple apps together in a single page.
Additionally, most of the apps I found online come with their own templates, which has the full html, and do not separate the logic of creating / preparing a context from that of handling a request and generating a reply.
What is the best practice here? What do you do? edit the templates that come from applications you download online? refactor them to fit in your application?
what should I do for my own applications? structure them so they have a method to get the context, and a method to render it?
Django hasn't great support out of the box to component-oriented architectures. I find this problematic some times too. You'll face to problems here.
Architecture
Code
Architecture: As Django is not component oriented, all the apps aren't component oriented neither. The designers and coders for those apps haven't thought about that. So they've just built "views" to interface with their apps. You'll need to get something more "pluggable".
Code: Once you decide to build that, you'll have to find what support you have for that. Most Django apps are pretty well coded, so you won't have much code in views, but abstracted in other places. That way you could reuse that code and build your own components.
Example: Suppose you're working with a third-party Wiki app. That wiki has a view to display highest ranked Tags and other view to create a wiki entry. If the code is good enough (that I'm assuming it is because Django has a pretty good community), you could refactor that to use components. The view to create an entry must be using some Form, that you can plug in your own site. And the view to get highest ranked tags probably uses some utility function, or some Tag manager's method. In that case you could refactor it to your own needs.
Hope it helps.

CMS+blog+e-commerce: django or web2py [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
At the moment we are running few smaller PHP sites (small company, private, non-profit org, friends...) and would like to migrate them to Python in order to be able to tweak them more easily and/or extend their functionality due to being familiar with Python although without real experience using some of the Python frameworks.
In order not to write everything from the scratch, we'd need decent CMS, blog and some e-commerce module.
We did some research, installed and tried few apps in Django world and so far have arrived to the two possibilities:
Django-CMS as CMS, Zinnia as blog engine and Django shop as e-commerce or
Mezzanine which integrates CMS+blog and Cartridge as shopping cart application.
Both combinations are nice, although not perfect...At the moment there is problem integrating released versions of django-cms & zinnia due to their usage of non-compatible versions of django-mptt or e.g. Mezzanine is missing some features like linkback support in blog etc.
While playing with the above two sets of apps, we heard about Web2py and must say that we like lot of things there...
We are aware it's younger project with smaller community, less apps etc., but wonder if there is some set of web2py applications which can compare with the two above-mentioned Django sets so that we can choose to start with Web2py, learn it and in that process replace PHP sites with it?
So, we would like to have some capable CMS+blog with the following features:
tag cloud, categories
spam protection
RSS feeds
multiple authors
threaded comments (optional)
linkback (pingback/trackback) support
(easily) theme-able
markdown/reST markup for writing content/posting
multi-lingual support
As far as e-commerce is concerned, besides easy integration with CMS+blog apps we do not need anything spectacular - our 'company' is selling 'services', so no need for thousands of products (only 10s of them), no complicated shipping options so something like:
multi-lingual support
basic infrastructure for payment methods (e.g.) PayPal and we would need to write a custom module for form-based API
simple shopping cart able to handle simple product descriptions
tax calculations and
(optional) PDF support
would be everything what we would need.
Considering the features we would like to have, our (non)experience working with any framework, which one - Django or Web2py - you consider is more suitable in terms of ease of learning, ease of use, application support etc. ?
I've sent two posts to web2py list and (maybe) because my query was not specific-enough (or some other reason) I did not receive any reply there and I saw there are some apps like KPAX CMS which looks old/non-maintained. Otoh, there is Powerpack which incorporates Instant Press but I'm not sure about availability of e-commerce component. Finally, I've found out about plugin_wiki which seems to be new/young app, but, considering we found* out about possibilities in Django-world, we would like to learn about the situation on the Web2py scene in order to be able to evaluate both options better.
p.s. it would be nice if Appliances list would be organized a bit better so that it's easy to find out what is maintained, where is project page etc.
I've had a lot of success with Django-CMS. It's very, very easy to write custom content-type plugins, extend menu nodes with custom nav elements, such as a list of product categories, etc. It's dead-simple to hook custom application code to any page in the navigation hierarchy.
As you mentioned in your question, Zinnia also plugs into Django-CMS for a nice blogging solution that is also extensible. Adding a cart app, whether it's from the DIVIO team or not should be an easy task.
Django, DjangoCMS and Python in general, have very low learning curves in my opinion. In 14 years of development, Django is the only web framework that hasn't gotten in my way, and Python is an absolute pleasure to work with on a daily basis.
I think you'll find that the Django ecosystem is much more holistic than any of the other Python frameworks, it's also very, very well documented and there are literally hundreds of 3rd party apps. Plus, Django admin can potentially save you many weeks of dev time, and you can override, skin and extend it to do just about anything.
My $0.02 :)
-- EDIT --+
Yeah, right after I posted I realized I was heavy on comparison of frameworks but light on suggested solutions to your problem (i.e. existing appliances). I think that Django probably has more matured addins/apps. That being said, crafting your own blog in web2py (a simple blog) is probably only a little harder than configuring one for another framework.
There is the wordpressclone appliance: http://web2py.com/appliances/default/show/36
(you can extract existing wordpress data and get it in here, i'm pretty sure there's a WP export and an import function on this appliance)
There is an e-store (haven't used it): http://web2py.com/appliances/default/show/24
There is KPax CMS, as you said, but i think this one might be out of date, unless it was updated recently. The integration between these should be possible, you can share sessions across apps and I think if you have the same auth_user db, it should work.
I would try installing these and see if they are close to meeting your needs -- especially KPax since I'm not sure the state it's in.
-- END EDIT --
Both Django and Web2py are very good frameworks in my opinion. I think you would be happy with either. That being said, having not used frameworks I would say to with web2py, unless you NEED certain modules that only exist in the django world. Web2py probably has a little more gradual learning curve. Also, it can do RSS out of the box, there's a screencast somewhere showing how to create a blog app in about 5 minutes (including comments), and the community is (usually) very responsive. I don't think there is anything that web2py can do that django can't (except DB migrations -- but i think you can make django do them with some 3rd party code), or vice versa.
Django favors a "explicit is better than implicit" development methodology, which requires to you import various modules and doesn't have all the "magic" of web2py. Using django, you will be more aware of exactly what is going on under the hood. The django templating language is easy to learn and provides a lot of functionality for common markup tasks. Their is a LOT of documentation, a larger user-base and tons of 3rd party modules/plugins/whatever.
Web2py favors a "everything should have a default" approach, and enables to to focus on the big picture without getting bogged down by the minutia of web development. I'm not saying this is in contrast to django, but rather that web2py is very strong on this point. It allows you to rapidly develop applications, and takes the headache out of things like updating a table schema (i.e. it does database migrations). I also prefer web2py's templating language to django's, as it allows pure python and does not require one to learn a separate templating language at all.
I think both frameworks have decent internationalization/localization features. I'm not sure if Django's is still under development or not? Web2py's is easy to use, but I think you might have to provide a lot of the translations yourself.
As for the lack of replies on the web2py list, maybe it's because this topic is becoming more and more frequent? I'm not sure. You could ask people on the web2py freenode channel.
Also, definitely check out this link:
Django vs web2py for a beginner developer
The first response is from the lead developer of web2py, but I think he makes a fairly balanced comparison.
Also, the previous thread includes a link to here (the good and bad of web2py):
http://www.mengu.net/post/django-vs-web2py
web2py is a great framework, but currently light on reusable CMS, blog, and particularly e-commerce applications. It sounds like you have already stumbled upon the main options -- plugin_wiki, Powerpack, and Instant Press.
I don't think there is a mature and currently maintained e-commerce application, but you may be able to make use of web2py-estore. There are also some options for accepting credit card payments (see also).
plugin_wiki includes comment functionality, and there is also plugin_comments. For PDFs, pyfpdf comes with web2py, and there is also web2py_appreport. web2py also includes RSS support.
EDIT: Also, another web2py CMS under development, to be released soon: SimplrCMS

use qt and django to create desktop apps

I had this idea of creating desktop apps using django. The principe being:
- Write the django app, and use something like cherrypy to serve it.
- Write a Qt app in C++ to access it and this by using QtWebview (webkit)
I'd like to "bundle" this in a single app. The lighter, the better :)
So here are my questions and if you have better ideas and suggestions, please
share them :)
Is it possible to serve a django app with a c++ one? (a c++ server embedding python)?
anyone did this before? Do you have some articles, blog posts?
Thanks a lot!
Django has it's own server. Why involve CherryPy?
You're creating a hellaciously complex architecture for no recognizable purpose. Your comments are almost impossible to parse in the context of your question. Please consider rewriting the question to address your actual concerns with an actual thing you actually wrote.
"I ... used pywxiwdgets in the past and it was SLOW"
There are many of desktop frameworks. Use another one.
Don't introduce Django -- it's for web applications, not desktop applications. The overhead of messing with Django and CherryPy is silly.
Find the original reason for SLOW. I'll bet it was database slowness from using SQLite. If not that, I'll bet it was a poor data model. If not that I'll be it was poor use of the pywxwidgets. If not that, I'll bet your desktop app made internet connections that were slow. Indeed, I'd bet that almost any part of your app was the culprit and making a super-complex architecture will not make things faster, just more complex.
Until you identify -- and measure -- the original cause for slowness, you're not actually solving the actual problem you actually had.
Look at http://www.python-camelot.com/
It says "A python GUI framework on top of Sqlalchemy and PyQt, inspired by the Django admin interface."
Pyjamas Desktop can probably be integrated with Django. And there's no need for C++. It currently uses pywebkitgtk, but I don't think there's any real reason why it couldn't use PyQt4 instead with a bit of work.
Use PyQt or PySide instead of C++.
you can use electron-api-demos this opensource
and Now this technology is considered the bright generation, so one of the most famous people who used it is YouTube and Visual Studio Code
https://github.com/electron/electron-api-demos

Django or Zope?

I want to create a website and I am confused which web framework to use. Please recommend me which framework is better: Django or Zope. I am using Python.
If you mean plain Zope2 by zope then I'd go for Django. Most interesting stuff in the Zope world takes place with either Plone or Grok (which is Zope3, which is actually quite different from Zope2).
Grok works nice with relational databases, Plone doesn't really, so if you depend on an RDBMS, either go with Grok or Django.
Zope and Plone have a rather steep learning curve so you'll get started more quickly with Django.
The largest downside about Django is, in my opinion, that it tries do do everything by itself (templating, object publishing, ORM, and so on) while there are many excellent existing components out there. If you want to be able to use your code / knowledge outside of the web framework you're using, consider Pylons or BFG
Many options, no clear answer, sorry :)
I have no idea what sort of website you're trying to create, so it's hard to recommend a specific framework.
I'd recommend getting through some tutorials to see which one you like best (There's also pylons and TurboGears to pick from).
Django seems to be the most popular starting kit these days though.
If your website is very hierarchical and needs fine grained permissions, I'd use Zope. (Don't use Zope if you intend to store your data almost exclusively in an SQL database.)
If you have large datasets that can be put into (sql)tables and need many forms, I'd use Django. (Don't use Django if you need very fine grained access control, and hierarchical data)
You see: both have their weaknesses and strengths (although I am only developing in Django these days. The Zope community seems to be a bit in dispute these days about the way it should develop)
Zope is dead. As is TurboGears, Pylons, BFG, Repoze, CherryPy etc.
Active and popular Python web frameworks include:
* django
* flask
* bottle
Big, medium and small. Take your pick.
Here is a good comparison of Django and Zope (and Rails)
http://cd-docdb.fnal.gov/cgi-bin/RetrieveFile?docid=2715;filename=Comparison.html;version=3
They preferred Django. I, personally, use Django too, so I don't know much about Zope.
Another good thing about Django is that they have very good documentation (though I don't know that of Zope). Many people praise that very much.
Also I found Django quite easy to use, and also they have a ready 'administrator panel', which allows quick web-oriented site management from the first steps. More important for me, however, is its fine integration with python and the simple organisation (in the link above they complained that Zope uses very much of its own features, while Django is closer to pure Python).
If you are starting from scratch I will suggest you should go for Django. You will get lots of features and suppost from django. Easy to debug and best suited for rapid developement. In the other hand, You should only choose Zope, if you have experienced developers familiar with Zope or have existing projects based on Zope and the cost of switching is too high for the potential value gain.
In zope's website it self it is written, It is no longer recommended to start new projects based on it, unless you are intimately familiar with the technology stack.

Need help choosing a framework for bilingual site

First, some background information... I'm coming up on a medium-scale website for a non-profit that will require both English and Korean translations. Feature-set includes: CMS for normal content, a blog, some form submission/handling (including CSV/PDF exports), a job posting board, a directory of related businesses and non-profits (that accepts visitor submissions), and a basic (probably blog-driven) newsroom.
I have a fairly strong development background, and I've done some sites using Drupal, built some basic custom CMSes using frameworks like CodeIgniter, and I've recently started getting into Django. These are the primary options that I am exploring, and I would consider using different tools for different portions of the project, but what I'm mainly interested in, is if anyone has any experience to share with regards to localization/internationalization. I haven't yet put together a site that supports multiple languages, so before I get in trouble by underestimating the task, or making poor assumptions, I'd like to get some input to help guide my decision-making process.
Do you have any recommendations for frameworks (Drupal, Django, CodeIgniter) that handle localization/internationalization/translation well for a CMS? I know they all support it, but I'm looking for real-world experience here (or suggestions for modules/plugins given explanations).
Sorry for the longwinded question, but I wanted to be clear as possible. Thanks in advance!
There is a distinction between "site" translation and content translation. Django handles the site translation great, out of the box. The content translation, however, requires making some decisions (there's no one right way at this point). This probably makes sense, because of the very nature of Django as a lower level framework (when compared to something like Drupal, which is intended to serve as a complete CMS).
There are applications for Django which are meant to add this functionality (in the form of translations configured at the model level):
Django-multilingual
Transmeta
Also, I found this question that is related.
The bottom line though, is that this is still being explored in the Django world, and neither approach has been decided upon for the framework. Also, although I haven't used it, Drupal has module support for this in the form of the i18n module.
I will update with more conclusions as I come to them. If you have anything to add about content translation in Django or in Drupal, feel free to add your own answer as well.
You probably already know that the native i18n support in django is quite good. As for translation, you might try the django-rosetta app which allows you to grant translation rights to a subset of users, who are then able to translate through an admin-like interface.
Zend_Translate is pretty comprehensive. And if you decide to use PHP, I suggest you take a look at it. It provides multiple interfaces (e.g. an Array, CSV, Gettext, etc.) to manage your translations, which makes it IMHO unmatched when it comes to PHP.
I'm not sure how well it plays with Drupal, since Drupal is hardly a framework but more a CMS -- or maybe a CMS framework. I'm pretty sure that Drupal either has a thing build in or that there is a plugin for it.
With CodeIgniter you would start from scratch and Zend_Translate plays well with it.
I liked Drupal over Joomla. You should also look into DotNetNuke, out of the box it has lot of things that will meet your needs.
Checkout django-blocks. Has multi-language Menu, Flatpages and even has a simple Shopping Cart!!