Django

#slider
#adsense

Django - Yahoo News Search Results

‘Suspiria’ TV Series in Development; ‘Django’ Also Coming to Small Screen

The Suspiria film remake may be dead, but that doesn’t mean you can keep a coven of witches down. There’s now a Suspiria TV series in development out of Europe, with original writer/director Dario Argento on board as “artistic consultant.” But you’re probably not expecting precisely this plan for the TV version of Argento’s film […] The post ‘Suspiria’ TV Series in Development; ‘Django’ Also ...

‘Django’, ‘Suspiria De Profundis’ Series In Works From Atlantique & Cattleya

France’s Atlantique Productions and Italy’s Cattleya have entered a co-development and co-production agreement to fashion English-language drama series out of Sergio Corbucci’s 1966 Western Django and Thomas De Quincey’s 1845 psychological fantasy essays Suspiria De Profundis . Django , to which Quentin Tarantino paid homage in his 2012 Oscar-winning Django Unchained , is positioned as a re ...

Django Girls make the male-dominated world of IT more accessible to women

An announcement regarding a Django Girls meeting at Hackerspace in the Athens neighborhood of Aghios Eleftherios on Saturday sounded more like a pop group fan club’s get-together than an event addressing a socially and economically challenging issue: the employment of women in today’s dynamic industries of information technology and telecommunications.

Django Django: ‘After our first album, everything went nuts’

Django Django’s first record propelled them from back-room gigs to the top of festival bills. How did they escape second-album syndrome? The last time Django Django talked to the Guardian, towards the end of 2011, they were preparing to release their debut album – a tuneful but experimental mix of psychedelia, folk and the sound of coconut shells being bashed together to make a noise like ...

Delicious/tag/Django

recent bookmarks tagged Django

something went wrong

Posted on

Top Answers About Django (web framework) on Quora

Top Answers About Django (web framework)

What are some good demo ideas or projects to learn Django?


There are lots of ways to learn Django or perhaps any Web Framework:
short personal experience:
In my last year of college, I wrote this engine to change Semantic Alphabet written text (right to left)  into it's phonetic relevant Character in Latin, or let's say English like letters. Then I spend a long while making it a web app, in which it helped me learn lots of things.

Web App / Project ideas:
http://syskall.com/some-crazy-an...

Here are some cool beginner app ideas overall:
Ideas for Coding Projects

Here some ideas from the existing resources:
SummerOfCode2014 - Django

Chris Oliver's blog:
10 Ideas for Beginner Web Developers
    1. Simple blog with comments
    2. Pastebin that has short urls (Google some short url algorithms)
    3. Make a todo list website (without Javascript)
    4. Go back and add authentication (I used devise) to #1 and #2
    5. Build a site to send text messages for you using Twilio
    6. Create a small site to upload files to using Amazon S3′s free account
    7. Go Back to #3 and Ajaxify it all. Add user accounts (with email reminders). I built Fluttrly.com somewhat like this.
    8. Build your own JSON and XML API onto #3 or any of the other sites
    9. Now take that API you just built and create a Ruby gem out of it using ActiveResource
    10. . Certainly by now you should have come up with some ideas of your  own that you’d like to build. If not, go build an expense tracker with  pretty graphs and export to CSV or Freshbooks functionality.

Bottom line:
Find something that excites you and spend time around it to become more exposed to it's fundamentals,use cases and benefits.

PS: some cooler stuff for Django (web framework):
33 projects that make developing django apps awesome 

Here is actually another question that might help with brainstorming of the idea.
What are some good projects/ideas in web development that a beginner can start with?

See question on Quora

Posted on 28 November 2014

Should I use PHP, Python (Django) or Ruby (on Rails) to build a dynamic website?


I've developed web applications in all three languages, with various frameworks within each. In my opinion, the choice is really between Python and Ruby.

Say what you will about PHP, and we can debate this for days, but PHP development is significantly slower than that of Ruby/Python. Worse still, this reduction in speed does not offer an improvement in quality as intuition usually tells us. In fact, given sufficient time, the robustness of both languages makes it hard for PHP teams to even achieve a codebase as elegant as one in either one of those languages.

The only time when using PHP is a good decision–again, IMO– is when it offers something that cannot be found in other languages. This is a very short list, as Ruby/Python have very robust lists of features, and offer similar–if not better–performance. However, if you're Facebook and have already hired hundreds of PHP developers, you should stick to it. Or you can hire programming language designers and compiler writers to develop an entire new programming language bearing PHP's syntax just to get out of the mess you put yourself into, which actually happened.

Now, Python or Ruby? Honestly, it doesn't matter; just have your pick. For your run-of-the-mill web application, the differences are virtually non-existent. Both languages have a strong community that follows modern programming paradigms and spits out new libraries like nobody's business. Python offers some impressive scientific computing libraries that Ruby somewhat lacks, but that's about as far as the differences go.

One final note: don't get hung up on Django vs. Rails. You might decide that a microframework like Flask (Python) or Sinatra (Ruby) is robust enough for your application's requirements–as is often the case.

See question on Quora

Posted on 21 November 2014

Which Python web framework was YouTube built with when they started off?


Contrary to popular belief, YouTube was first built with PHP when it started, and not Python. It subsequently got replaced by Python in a piece-meal migration within 3 months after its public launch, using the mod_python Apache module and very likely the mpservlets framework.

I explain how I came to that conclusion below.



YouTube was created in 2005 and launched publicly in November that year. On they Wayback Machine, the first entry that can be found is YouTube - Broadcast Yourself. (Apr 28, 2005), and you can see from the page source that many of the pages were of the form index.php, watch.php, etc. If you search Google for "youtube.com/watch.php", you'll also be able to find many legacy permalinks to that URL. While this can be emulated with Python controllers/handlers/servlets, it is high unlikely an elaborate ruse.

The first architecture diagram and mention of YouTube's tech stack is from this presentation sometime in 2008 by Mike Solomon of YouTube. In his slide deck, there was a diagram of their tech stack by January 2006, which showed a non-PHP stack, using Apache httpd and mod_python.

Super Sizing Youtube with Python



Using the Wayback Machine links above, you can quickly binary search and find that the first "servlets" probably started arriving after Oct 26, 2005, for
subscription_center
and
pl_manager
, likely as part of the new features introduced: Subscriptions and Playlists. (The crawls by the Wayback Machine sometimes are missing from a few dates, and those are commonly due to periods of instability when the service might be undergoing some larger changes causing the crawl failures, and so these dates can be used as quick hints.)


YouTube - Broadcast Yourself. (Oct 26, 2005)

YouTube - Broadcast Yourself. (Oct 28, 2005)

It seems the full migration occurred sometime between Jan 18 and Jan 26, 2006, where even the old endpoints such as
my_videos.php
and
my_messages.php
were replaced by their servlet equivalents directly. Again the period of many days without a successful crawl might suggest some instability during the migration process as new bottlenecks or issues are found.


YouTube - Broadcast Yourself. (Jan 18, 2006)

YouTube - Broadcast Yourself. (Jan 26, 2006)

After this final full migration, YouTube must have landed on the architecture mentioned in the slide deck above.



The possibilities for what YouTube could have been using behind mod_python are pretty limited. At that time, I was pretty actively looking through Python web frameworks before deciding to give Django (web framework) a try back in 2006. Given that both CherryPy and Django were relatively heavyweight framework with their own ORMs, it would have been pretty hard to migrate over from PHP to them in a piece-meal fashion. The value of those frameworks would have been greatly diminished. They were also early in their lifecycle, still in beta and hot on the heels of Ruby on Rails.

That leaves Python Server Pages (PSP) and mod_python servlets (mpservlets), both of which had been around since at least 2004. I recall PSP as being relatively unstable at the time, and so I believe YouTube must have landed on the latter. Another hint is that in the slide deck, it's mentioned that the business logic was being served within "servlets". Of all the web frameworks at the time, I believe only mpservlets used that term.

See question on Quora

Posted on 10 November 2014

What is the one thing that you wish you knew about Django framework early?


1 thing? ..... How about 11:

https://medium.com/cs-math/11-th...

text from the article:

I started SocialQ and Math & Pencil just about two years ago. Before I started the companies, I had almost zero web development experience (I’m a data guy) - I started a company learning HTTP, Javascript, AJAX, and Django MVC from scratch. It’s been a wild ride, and our technology stack has since matured to using interesting technologies such as D3.js, Backbone.js, Celery, Mongo, Redis, and a bunch of other stuff - but it didnt happen over night. Looking at the thousands of lines of Django code everyday, I thought it would be worth pointing out things I wish I did differently:
http://...

1.Start off with the right directory structure: Starting off, I looked at a few different open-source projects for guidence ([1] and [2]), read a few blogs, but never had good idea on the best way to setup a Django project. Here is what I am currently using:
http://...
http://...The apps directory stores all of your customized django apps and thevendor directory stores any apps you do not want to install (or can’t install) using pip or easy_install. The bin directory stores all bash scripts that help you automate your development. I have scripts in here that deploy to staging & production servers, clean up directories, compress assets, backup databases, start/stop celery (locally), etc. The config directory stores all of your configuration files for databases, webservers, munin, celery, supervisor, etc. The media directory stores all static assets such as javascript, css, images, fonts, etc.The template directory stores all the html templates that make your site beautiful. Finally, the static directory is where your compressed assets get dumped into for production. I even created a template for you on github,go star it!
http://...

2. Use Celery for asynchronous tasks AND cron jobs (no need to use unix crontab): The first two weeks of development you might not need to shove something into an asynchronous process, but when your non-technical co-founder starts asking why the site is hanging, it’s time to bust out celery (there are other options if you need something more lightweight). Any call that doesn’t need to be synchronous can be queued up and eventually consumed by a celery worker. I recommend using redis as a celery backend (see below) - do not waste your time with RabbitMQ unless you have a good reason to. I use celery for all sorts of tasks from sending out emails to pulling data from the Facebook API. Another intersting use of celery is you can setup periodic tasks to act as a cronjob. When I first started developing SocialQ, I was using UNIX crontab but have since moved everything into celery.
http://...

3. Use Gunicorn instead of Apache for your webserver: I know - Apache is battle-tested and all (plus it got a lot of love in The World Is Flat), but two years ago, when I didnt know shit, it was pretty complicated to setup. I just wanted to get a website up and running and forgot about a print statement in my code - whoops— that took down my site with a 500. Apache has a large set configurations that are time consuming to understand.Gunicorn isvery simple and gets the job done. Huge sites are using it too, at scale, so if you just created the next Instagram, you know you’re servers are not going to fail you[1]
http://...Update: This assumes NGINX is managing all incoming requests and serving static content.
http://...

4. Don’t be afraid of using MongoDB as your primary data store: There is a lot of hate floating around Hacker News when someone starts talking about MongoDB. I am not gonna sit here and act like it’s the pancea for all web storage problems, but I will tell you what it is good for - fast iteration.South does a nice job with RDBMS migrations, but migrations seem a bit easier in Mongo (see $set and $unset). Two years ago, things were different and Mongo was much less mature — but since then 10gen has added the aggregation framework, full-text search, collection-level locking, etc. I am glad I started with Mongo and it will continue to be my primary datastore.Mongoengine works great with Django, and if you need more control, you can jump down into pymongo. A lot of other big companies love MongoDBtoo:
http://...

5. Use named URLs, reverse, and the url template tag: This one seems dumb, I know, but man - I wish I knew about reverse when I started. Do yourself a favor and name all of your urls, and only refer to them by name in both templates using the url template tag and using reverse in the backend. It will potentially save you a lot of time in the future because nothing will be hard-coded and one url change will not break the site and unit tests.
http://...

6. Get your settings.py file right: There has been a lot of discussion about what is the right approach to Django settings. You can read about these discussions here and here. Personally, I like adding local_settings.py to my top-level directory and then importing it at the bottom of my settings file, overriding any variables declared above it in settings.py. My method works well for me, but you should definitely figure out how do separate development, staging, and production level settings.
http://...

7. Use supervisor for process monitoring: If you havnt heard of supervisor yet, and you are deploying to a unix-based machine, go here and start reading. Supervisor will control all of your processes for you. You just need to add a separate configuration file for each process. If the process goes down, supervisor will bring it back up. Examples of supervisor processes: Celery-beat, celery, gunicorn, statds, mongodb etc.
http://...

8. Pick the right AJAX/JSON mechanism: Unless you want to do a full page reload with every HTTP request (which is completely ok, but SO 1995) you are going to want to send some data to the server using AJAX. The problem you will quickly hit is Django does not have a built in JSON HTTP response, so you are going to have to either man up and roll your own (good luck) or copy someone else smarter than you (this is what I did). Here is adecorator that works great, and this response is superb also:
http://...

9. Use Redis - because it will eventually be your best friend: As I suggested above, at the beginning, Redis can just be used to queue yourcelery jobs. Later on, when the time comes you can store your sessions to redis. Then, you can use redis as a cache. Then you can use redis for auto-completion. Then …. I rest my case - just use Redis!
http://...

10.Use munin and statds for process monitoring. Munin lets you make nice graphs of almost anything, statds lets you time or count (increment) anything. Add these to your project as soon as possible and monitor everything. You can easily write your own munin plugins in Python to monitor just about everything.
http://...

11.Use jammit for static asset compression. Jammit came out ofdocumentcloud, and even though it was built for Ruby on Rails you can do something like this and use it for Django pretty easily. One of the things I like about it is you can setup different named configurations for javascript and css for different sections of your site (dashboard, non-authenticated, standard). It supports lots of other stuff too.

See question on Quora

Posted on 8 July 2014

I want to learn to code Python and Django (web framework). What's the best way to start for a programming newbie?


First download MacPorts or HomeBrew ( I suggest MacPorts). These two products are package managers, and will save you a ton of work.

Next use the package manager to install python (sudo port install python2.7). Work through Learn Python The Hard Way. This will give you a good understanding of Python.

Now work through Writing your first Django app, part 1, all the parts of it. This will get you up and running in Django, and you will learn how to write a basic Django app.

Now try something harder: The Django Book. This page supports up to Django 1.4, so use 1.4 for it. Most of it will be translatable to 1.5. The book uses a tutorial structure, so you will build a small app while learning all the neat things Django can do.

I would recommend Python as the best place to start. Its a quick, syntasically easy language. Start with learning Python; learn what the differences between 2.X and 3.X are, learn about PEP8, write some Python. Understand imports, understand where Python imports stuff from, learn about PIP and how to get new packages. LEARN TO USE virtualenv; this is an absolute must!!! It will make your life 100 times easier.

As for software. Find a good editor you like. A lot of people like Sublime Text 2. I prefer Vim+tmux, but that might be to much at once if you are not used to editing. You will need a decent amount of time, don't expect to become a master in a few days. Django can sometimes be infuriating, but don't give up, the reward is well worth it. You can probably work through Learn Python The Hard Way in a day or two; then you can start writting basic python apps. The Django tutorial should only take an hour or two; then you can start running basic Django Apps. Now the Django book might take longer, it's pretty lengthy, but it goes over everything.

If you have any other questions feel free to ask.

See question on Quora

Posted on 10 October 2013

What are the best ways to improve Django performance?


  • Cache your views when possible using Django's internal cache Django’s cache framework.
  • Cache your queries using django-cacheops by now is the best I have used and it's compatible with Django 1.5 (it uses Redis). *
  • Use djcelery with Celery: Distributed Task Queue for every task that can be delayed (i.e. sending an activation email).
  • In production use nginx as reverse proxy with Deploying Gunicorn I am using Gunicorn after running some benchmarks with UWSGI, Gunicorn won and it is really easy to setup compared to UWSGI!
  • Use Gunicorn with greenlet/gevent (this requires libevent installed on your system).
  • Stay away from the dbms whenever possible, one thing I learned using Django is that the main thing that slows really down your application is the database. Scaling at application level really helps.
  • If you are going to use Postgresql use Autocommit = True in your settings and keep in mind that the upcoming version of Django (1.6) will support connection pooling with psql.
  • You can debug your application and see what is slowing down the app with django-debug-toolbar one of the best tool I've ever used. You can see SQL Queries in every view.

EDIT:
* I saw major improvements using johnny-cache instead of cacheops, by the way this is strictly a personal choice. You should try and see what is better suited for your app.

See question on Quora

Posted on 28 September 2013

What is the Django programming language?


I suppose that we should start by clarifying that Django is not a programming language ;). It is a web framework written in the Python programming language.


In very non-technical terms: Django is a kit that provides the the basic infrastructure for a website (specifically, it handles the backend). It is a system for you to organize data and web pages, and to serve them appropriately depending on the situation (e.g. what page the user is trying to visit, who the user is, what information is in your database, etc.).

Programmers like to use frameworks like Django because they make it easier to build projects. As a result, development time tends to be much faster both initially and in the long run. You don't have to reinvent the wheel at the beginning, and the framework provides some well-thought out design patterns for you to follow as your project grows in size.

Django was originally developed in 2003 by a team in the web department at the Lawrence Journal-World (a daily newspaper in Lawrence, Kansas). It has since become an open-source project that thousands of people across the globe have contributed to.

According to the Django FAQs, the name comes from Django Reinhardt, a jazz guitarist who was active from the 1930's through the early 1950's. I guess the creators were big fans.

http://www.youtube.com/watch?v=Q...
Django Reinhardt - Honeysuckle Rose


See question on Quora

Posted on 18 August 2013

What is the one thing that you wish you knew about Django framework early?


Middleware! I was having a problem in an app where I needed to pass a specific header when the incoming request was coming from IE, and before I knew about middleware I wrote an "examine_request_source()" function that would set a flag, which would be read by a custom render() method and dealt with appropriately. The equivalent code in middleware was about 5 lines, and didn't muddy up any of the rest of the code.

See question on Quora

Posted on 9 August 2013

Why is there a recent trend away from PHP towards Python and Ruby on Rails?


IMHO developer background.

I've always seen PHP as language for web designers that want to throw in some application logic. Sadly the code quality looks like that.

Ruby (on Rails)/Python (Django) mostly court software developers, not frontend guys. IMO this can be seen in the default infrastructure and software patterns (MVC).

This is a boon for larger projects. Prior to Rails the overhead for bootstrapping a "real" rails web application when compared of doing "designing a web site and adding some dynamic PHP code" was way to high.

Of course there are PHP MVC frameworks, etc. that try to improve the situation, but somehow PHP already got a bad reputation and it's hard to overcome this.

See question on Quora

Posted on 27 May 2013

Why is there a recent trend away from PHP towards Python and Ruby on Rails?


The advantage of Ruby on rails is that it's compatible with all known variants of web servers and databases. But the main merit of this technology is that it allows developing web site 30-40% faster in comparison with PHP due to numerous libraries and code. There are much more pros in this technology, you can look through Ruby on Rails prop following this link.

See question on Quora

Posted on 20 March 2013

Why is there a recent trend away from PHP towards Python and Ruby on Rails?


Versatility.

PHP is a great language for the Web. Python is a great language for Web Frameworks, as System glue language, is widely used in Linux, advanced data analysis libraries, works with QT Gtk has bindings and libraries for nearly anything you could imagine. In use in software in hospital MRI imaging, Games and on it goes.

Also many universities have changed their intro courses from being C or Java based giving Python a lot of respectability and mindshare in graduates and the business community.

Lastly Google is synonymous with the Web and they are behind Python and Guido(python creator ) works for Google.

That's a lot of use cases and mindshare to propel the use of a language .

See question on Quora

Posted on 15 March 2013

Why is there a recent trend away from PHP towards Python and Ruby on Rails?


At least where I'm at in my career path, the main reasons can be summed up best by the following statement:

It's easier to go wrong with PHP

That's not an inherent problem, it's just the way it has panned out.

The problems you can commonly make with PHP stem from its lineage as a simple web scripting language rather than a programming language proper.  These are not the kind of things you are going to get bit by at the typical webapp or website scale, serving simple dynamic content via apache/php/mysql.  These are the kinds of problems you only get to appreciate after you've worked to scale, where your threaded networking model is immediately apparent as a bottleneck.  You immediately appreciate the modular namespacing and alternative networking flexibility of other languages after you make the switch.

You can make very elegant and highly scalable code in PHP.  There are many, many examples where I work presently.  It's just that you only learn these techniques after you've been bitten, and by then, if you have the option to make the switch to something new, you are pretty sorely tempted just on the merits of the alternative.  You don't come into web development understanding the value of organization and namespacing, you learn it over time.  I made the switch to python years ago, and only periodically looked back when professional needs (clients or jobs!) demanded.

PHP has tremendous mindshare.  It deserves the respect it's gotten as most developers introduction to web programming.  It's team is also to be commended for their recent efforts to modernize its structure vs Ruby or Python since the release of v5.  However, none of this changes its typical use-case - a front-facing webapp answering HTTP requests most likely tied to Apache or Nginx.

Consider some other complex problem domains - there are no machine-learning libraries for PHP, for example.  Consider writing an in memory inverted index, something like what Sphinx search uses for example, in PHP... there are so many uses when you scale out that PHP is not well suited to: Asynchronous networking a la Nodejs or Tornado?  Graceful interface design between CLI, web, and GUI?  Special network protocol programming (socketio, amqp, etc)?    Most PHP devs would argue that they are not interested in these problem domains and that PHP is not the tool, and they are right, at least until their professional environment demands it.

So, succinctly, to answer why the companies you are looking at are switching, it's only because they grew larger, and their needs diversified greatly.  Over time, they needed to trade up.

See question on Quora

Posted on 7 March 2013

Why is there a recent trend away from PHP towards Python and Ruby on Rails?


Since you mentioned framework and language in your question i guess i will provide my opinion on the framework use since that's what most probably you were thinking of.

Right now even though i want to believe so i don't have a felling so many companies are moving into direction of using Rails or Django. Pure reason for this is lack of cheap work force.

Those that are moving have obviously identified new technologies and frameworks as a better suit for their needs.

Since we can't say for certain that any framework is the best it usually comes down to cost effective way to complete the job.

See question on Quora

Posted on 24 February 2013

Have there been any reviews of the 2 Scoops of Django eBook?


Haven't purchased it yet, but here's what Hacker News people had to say about it (almost all positive):

scorpion032:
* The book has a lot of practical advice having developed using django for years. For example, the book recommends, whenever you have a custom manager, always explicitly define `objects` as the default manager, before the custom manager.
* The book makes a recommendation; but also mentions alternatives where applicable. The authors prefer a 3 tier project layout but also suggest that a lot of people prefer the 2 tier layout where the `manage.py` is in the root of the repository. Similarly in the chapter on the Class Based Views. The book suggests an approach and also includes other ones.
* Includes the latest and the new changes in the django 1.5 wrt the User model and how to inherit.
* Recommends and suggests many good third party applications. More books need to do this.
* Provides good review material (if you already know) about Security, Deployment, performance etc.
All of this, just over the top of my head.
Real world advice is often hard to come by. Whether you are a professional or a novice or just checking out django, you should buy this book.

bdesimone:
I develop Django professionally, bought the book, and just finished a quick read through. I am very impressed. Some may rightly say you can get all the information in the book elsewhere and for free, I wouldn't want to. This book would have saved me many hours over the last few years. $12 is a bargain. I think the depth and breadth is just right and would highly suggest it for (nearly) every level of Django developer.
My one complaint, to not just this book, but pretty much the community at large is there exists scant documentation dealing with 'enterprise grade'database migration (..both data and schema, for some reason data is always left out) with Django and South.
Nice work.

th:
This is a really great book. The formatting does need a lot of work (I see no chapter or section headings in the PDF) and an ePub version would be very useful.
The actual content of this book is excellent though. I feel like I keep up with new developments in the Django community pretty well, but there's a lot of advice in this book I hadn't heard before


wifarley:
Just finished the first chapter and I'm probably not putting it down again (after I write this comment). This feels like something Django really needed (or I needed for Django), despite its extensive documentation. I find analogies are very helpful for my understanding and the ice cream one is perfect. The fact that "Each Chapter Stands On It's Own" is the great too!


hrayr:
The humor in this book makes it a joy to read, but the content is what makes it a must read!


antihero:
It has ice cream on the cover? Sold. Seriously, I like books that feel warm and fun, even on serious topics.


More at Our Django Book is Launched

See question on Quora

Posted on 30 January 2013

How do you organize multiple projects in a codebase with shared logic?


DECOUPLE! DECOUPLE, DAMN YOU!

At Spotify, we have learned, through maintenance pains equal to the heat or a thousand burning suns, that decoupling is the way to go. Basically, decouple until it hurts.

We found that the more stuff you build into a thingamabob, the more brittle it is. Partly just because more code inevitably means more bugs and more hairy maintenance, and partly because the more responsibilities a system has, the more other systems depend on it. This, in turn means that the service will fail more because it's under greater stress from many other apps (which, as a bonus, will fail with it).

The Spotify backend (which is Python to a very large degree, by the way) consists of about 100 different services. They are all very, very simple and are stricly focused on doing one thing well. Most of them are pretty autonomous, meaning that they depend on few other services, and when they do, they assume that the other services get slow and/or go down from time to time.

Note that these are separate services. They have their own code base and their own databases. For instance, the playlist service is completely separated from the user service and the music storage. Sharing a single database is NOT a good idea - it quickly turns into a massive, unmaintainable horrible thing that must not fail, but does, all the time. :) I have observed this "master database" phenomena first-hand in other companies, and it's NOT fun and happens REALLY fast. 

These services talk to eachother using a propietary protocol, but used to be done in HTTP.  HTTP will do fine for most services, the reason we no longer use HTTP at Spotify is because our load situation is extreme - 20 million users streaming music is crazyhat.

Spotify makes incredibly extensive use of git submodules, which is definitely a workable solution. However, I'm personally not a fan. Git submodules are not designed to be a package manager, and if you can, use actual package managers instead, such as pip or easy_install for Python, npm for node.js or gem for Ruby. It will save you a lot of pain to have sematically versioned packages in place instead of messing with git submodules. To set up a private package server, I recommend Gemfury.

We do, actually use a single repository for all this, and git seems to handle this just nicely. If you use Github, you might as well use separate repositories, but it's very tricky to setup without.

Edit: More fun reading about the Spotify backend can be found in this answer: What is Spotify's architecture?


See question on Quora

Posted on 10 December 2012

Do I use PHP, Node.JS, or Django for RESTful service?


I don't have much PHP or Django experience, but maybe I can help frame this question a little differently.

The choice of a language/platform should be about a few factors, some of which have been called out here, but by looking at these factors the right answer usually becomes pretty clear.

First, you can build a robust solution with any of these technologies.  But they aren't all designed for the same things.

The web has gone through some specific stages of evolution and the "hot" technologies have been a reflection of that.  The early programmable web was focused on rendering HTML with some amount of dynamic formatting or content: PHP was designed to handle this scenario, and it does it very well.  Later websites were rendered as highly dynamic and driven primarily by a data model backed by something like MySQL.  Ruby on Rails was designed to handle this scenario, and it does it very well.  And the more recent trend of websites being highly dynamic both in terms of render and in update (in other words AJAX/Single Page) where parts of a page will regularly make server calls and update independently from main page, with lots of small requests going back at high frequency.  Node.js was designed to handle this, and it's not as awesome at rendering HTML, though it works.

With that in mind, here are the other considerations that come to mind:

  • Organizational Climate:  Is your company one that is conservative on technology decisions or one that allows using newer, emerging technologies?
  • Hiring/Skills:  What is the skill-base of your workforce?  How hard is it to find people that can manage working on a given technology?  Are they flexible and quick to pick things up, or are they narrowly focused on what they already know?
  • Specific Functionality:  Does the stack in question support the systems you need to integrate with - MySQL, MSSQL, AMQP, etc.  Will you have to write support for these and/or maintain it yourself?  Are there Apache features you need, Nginx, etc?
  • Performance:  What type of load do you expect your system to experience and how does it scale under this load?  Node, in particular has a very horizontal scaling model due to it's threading (er, non-threading) characteristics.  It's not too bad with cluster, but it doesn't do multi-proc, for example.
  • Setup and management:  I'm not too familiar with the others but one of the nice things about node is that you don't need a separate web server.  For many scenarios this is super handy for deployment and management.
  • Tooling:  Older and more widely used systems tend to have better tooling across the lifecycle: CI servers, deployment scripts, compilers/optimizers, debuggers, etc.  The less of these you have, the more experienced and skilled you need you developers to be.

If it's true you're "routinely building simple RESTful web services", my experience is that node + restify handles this very elegantly, but it's equally doable in any of the technologies listed.

See question on Quora

Posted on 4 November 2012

I want to learn web programming online, where should I start?


The first thing you need to do is get MAMP if you have a mac or XAMP if you run a windows machine. It will let you write code on your computer, so you can begin to explore some of these concepts. It's easy to load up and there is a lot of support for beginners.

Conceptually, I'd start here: http://code.google.com/edu/tools... . (It does NOT really work like this but...) A database is like an excel spreadsheet on steroids. Your goal is to understanding the difference between a spreadsheet file and a database. The sooner you understand one-to-many and many-to-many relationships, the better. Think about everyday life things and try to map out the relationships in your mind.

In the meantime start playing with HTML and CSS. Make a page or two; you'll be surprised how easy it is to start (and how hard it is to master). There are countless quality tutorials out there, most are them are good but in general I'd avoid w3 school. Run everything you do through this validator: http://validator.w3.org/ it will tell you how much you are screwing up and what you need to redo.

The best way to start with PHP is here: http://www.php.net/tut.php . PHP was created with beginners in mind, yet can scale to incredible heights. The manual teaches you exactly what you'll need to know and one day you'll thank Rasmus Lerdorf for his genius and his openness to newbies.

Write a small app that does something simple and, once you complete it, move onto object oriented php and an MVC framework. I'd recommend using Kohana, Codeignitor or Zend.

Best of luck, it is a long hard road and you'll need raw determination and a level head to get through it. But, the fight is well worthwhile.

See question on Quora

Posted on 29 October 2012

Why is there a recent trend away from PHP towards Python and Ruby on Rails?


PHP was the first open source language designed for the web and reached maturity around 1999 with the release of PHP4.  Before PHP there was only perl (free, but a general purpose scripting language, kind of hard to learn) and ASP (which was not free and required an enterprise-level budget to run.)  So PHP had a head start of about 6 years over Ruby andy Python.  (These languages existed since the mid 1990's but had no web frameworks written for them).

Despite PHP's many shortcomings (lack of true object orientation, weak exception handling, no lambdas, and as others have mentioned, being essentially a huge flat namespace of inconsistently-named functions) it won by its ubiquity.  It was free and even the cheapest commodity web hosting providers were offering PHP by 2002 or 2003, so it had a full generation in Internet years to establish itself as the common language for open source developers. 

The emergence of Rails in 2005 began to change that but it took a few years for Rails to gain mainstream acceptance.  Python followed suit with the development of the Django framework, on the same MVC pattern as Rails. 

Services like Heroku were essential in getting Ruby to the mainstream - you no longer needed to have dedicated servers or know how to compile source code to run a Ruby server - you essentially had the same consumer-level pricing for running Ruby apps that you had with PHP. 

Ruby and Python are overtaking PHP because developers tend to favor the languages - they have better abstractions and allow programmers to be more productive.  Also, the ubiquity of PHP worked against it a little because it meant that less skilled programmers could contribute code and the quality of code in PHP projects is generally of a much lower quality as a result (see WordPress plugins for example) while the Ruby and Python communities have focused on developing better coding practices like Test Driven Development.  As a result, people who use Ruby and Python are perceived as "better" programmers, and more desirable hires.  New technology-focused companies are thus more likely to start projects in Ruby and Python because of the perceived higher quality of developers, even though for most web applications, an experienced team ("experienced" being the key) using Symfony or Cake can be just as productive as a team using Rails or Django

There's always going to be a fringe language X that's favored by hackers and academics, but has no obvious business application and thus stays obscure, only to seemingly come out of nowhere years after its invention when the critical mixture of a user need and practical libraries is achieved.  Today it might be Haskell or OCAML or Scala.  It's been LISP for about 50 years now.

See question on Quora

Posted on 27 October 2012

Why is there a recent trend away from PHP towards Python and Ruby on Rails?


Aside from the intrinsic qualities of Ruby or Python over PHP, there are some logistical ones.

The mindshare of using Ruby or Python has increased.  Frameworks like Rails and Django have grown in popularity.  It means there's more engineers who know how to use Ruby or Python.

There was a time when launching a site in Ruby or Python would mean a bit of a risk in available engineering talent, but now Ruby and Python are fairly easy to use languages, and these days it's almost easier to deploy Ruby or Python rather than adding mod_php to Apache.

See question on Quora

Posted on 14 October 2012

What should I write my web app with?


PHP is a programming language whereas Rails and Django are frameworks which means they're completely different so PHP won't give you paginating out of the box (or any other language). However, Symfony or CakePHP may give you paginating which I believe they're Rails/Django equivalent of PHP world.

My personal choice would be either Rails or Django.

See question on Quora

Posted on 21 June 2012

What should I write my web app with?


PHP is a language that is extremely easy to learn and code, but notoriously difficult to maintain (and maintaining a piece of software is the biggest part of it by far - the real work starts when the site launches, it doesn't end, as one would often like to believe)

Python+Django is the solution of all mentioned that will offer you the most guidance and hand-holding of how to do things, while both Ruby and PHP offers you significantly more rope to hang yourself with as a new programmer.

Then again, the first piece of software that you'll write as a programmer WILL be a unmaintainable pile of shit regardless of what language you use, and will need to be re-written if the app becomes successful - so go with whatever you think is fun and resonates best with your personality.

See question on Quora

Posted on 18 June 2012

Why is there a recent trend away from PHP towards Python and Ruby on Rails?


I'm not sure if there is such a trend, I just write what I think.

Personally, I think Python/Ruby is better than PHP.

  • PHP has many very_long_name_functions, which is really annoying. While Python/Ruby's object system can prevent the very_long_name_functions.
  • Ruby/Python is a more generic language, and has more libraries than PHP has, also some useful container data types, list/Array, dict/Hash. which is more powerful than array in PHP.
  • The frameworks in PHP is not as powerful as Python/Ruby, for larger application, framework is usually important to organize the codes for later maintenance.
  • SQLAlchemy/Django ORM/ActiveRecord eases the switch between different databases, and can help prevent SQL injection.

But I know little about Ruby, the following is about Python only.
  • Auto-named namespace. The namespace is just the module name.
  • Any object can be callable like a function with __call__ method.
  • Functions are also plain object and can be passed to any other functions.
  • Metaclasses are available to customize the creation of a class.

And I recommend you read more about PHP/Python/Ruby comparison. But I'm curious why there are more web application written in PHP instead of Python/Ruby.

See question on Quora

Posted on 7 June 2012

I'm making a website that will heavily make use of machine learning and data mining algorithms. Should I use Django or Rails?


Here's a thought: write the ML part and the web interface separately, and have them communicate by a simple internal API. Then you can write each part separately, in whatever language.

For instance, you might decide that it made sense to write the numerically intensive parts in R, but writing a web frontend in R would be the act of a crazy person.

See question on Quora

Posted on 30 May 2012

Is there anything Django can do that Flask can't with blueprints/extensions?


Having used both - Django for full-fledged sites, and Flask for API backends, Django's benefit is in its community, insanely good documentation, easy-to-extend middleware and context processors, and of course the built-in admin site.

Flask is capable, but I found myself mimicking a lot of the functionality in the fashion of Django while using it. SQLAlchemy is pretty cool but requires a MUCH larger learning curve. Testing is much more manual. Documentation is severely lacking compared to Django.

I don't really buy in to the separation-of-apps thing in Django. It works as psuedo-namespacing but i've rarely if ever seen apps be able to exist completely independently of each-other... so I won't tout that as a feature.

That said, if your site is significantly small... or as in my case, if you are building say, an API that only passes JSON back and forth, or may only have one or two pages to the entire site, Django can be an elephant gun for an ant. I used Flask, SQLAlchemy, and the "apy" Flask extension to build an API to backend a turn-by-turn iOS game. It scales just fine, and is less resource-heavy than Django.

Most importantly, though, is due to the maturity in Django, things like JohnnyCache exist and are amazing, stable, and scalable. SQLAlchemy has serious issues with putting objects in memcached, for instance, that you have to work around from scratch (and won't find out about until you think you're almost done.)

In either case, use Jinja2 - so much faster, more capable, and binary-cacheable. :)

That's a lot of words, I hope you find it helpful.

See question on Quora

Posted on 4 May 2012

What are some best practices for Django development?


Here are some things I have learned over the years that have helped me:

1. Try to setup your projects with the following directory structure

/myproject
   /apps
   /configs
   /settings
   /deploy
   /static
   /templates
   urls.py
   fabfile.py


apps - contains subfolders with specific functionality (static, accounts, etc)

configs - stores all configuration related scripts (gunicorn, nginx, celery, mongdb, redis, etc). It's useful because you can use fabric (put command) to copy these over to the correct locations on a server

deploy - contains all deploy scripts, set up in similar manner to this project[1]

A lot of examples you see online put everything into a single fabfile.py, but that gets really messy as a project gets larger. Having a deploy folder that is organized like django-fabtastic allows you to cut-and-paste it over into other projects if you are using the same technologies

settings - a folder (not a file like settings.py) that is setup based on this reference [2]

You could use local_settings.py, production_settings.py etc. but that yipit guys got it right and that is definitely the way to go

static - contains js, css, images, types/fonts

templates - all your html files

2. Use gunicorn[3] instead of apache. If for no other reason, a print statement in code wont crash the entire site. Gunicorn is less bloated and very easy to configure. And large sites like instagram are using it at web scale so dont let people tell you its not a good idea - it will make your job easier and you can leave the office and drink a lot more beer

3. Use celery for anything that can be made asynchronous (sending emails, uploading photos, etc). Dont make the user wait for the request to return, push it onto a queue and let celery do the work for you. Also, do not use rabbitmq as the celery backend, use redis. RabbitMQ is supposedly more stable and messages cant get lost, but it's also a pain to configure and 99% of people can afford to lose a message because a lost message really doesnt matter that much.

4. If you are going to use a SQL-based solution, then use South for migrations. I  have had a lot of success migrating away (completely) from Django's ORM[7] and sticking to PyMongo[5] + MongoEngine[5]. Development is way more fun if you're using MongoDB, if you do not believe me, try it out. Say goodbye to painful schema migrations. Ya, and I know, MongoDB doesn't scale, but guess what, it does.

5. If you need to make a REST API, then use Django-TastyPie[8]. Unfortunately, there is currently no good solution for constructing RESTful APIs if your backend is MongoDB. If I am wrong, provide a link please because no one on StackOverflow could[9]

6. Do not use test.py for unit tests, put them in a directory called tests/__init__.py and import them in that __init__.py file. Also, trying using
nose, it's really cool.[10]

7. Look and good open source project for reference. The most obviously is the Django project itself[11], but Newsblur[12] and Everyblock[13] are also great references:

That is it- that is 3 years worth of trail-and-error for free!

[1] https://github.com/duointeractiv...
[2] http://tech.yipit.com/2011/11/02...
[3] http://gunicorn.org/
[4] https://github.com/ask/django-ce...
[5] https://github.com/mongodb/mongo...
[6] https://github.com/hmarr/mongoen...
[7] https://docs.djangoproject.com/e...
[8] https://github.com/toastdriven/d...
[9] http://stackoverflow.com/questio...
[10] http://readthedocs.org/docs/nose...
[11] https://github.com/django/django
[12] https://github.com/samuelclay/Ne...
[13] https://github.com/dkukral/every...

See question on Quora

Posted on 1 April 2012

How can I look up Django functions?


You can use the ./manage.py shell command to get a shell which will import any Django modules (or any of your own code) without complaining about the location of the settings.py module. Install IPython first to get a much more useful interactive shell when you run that command.

Once you've done that, "from django.http import HttpResponse; help(HttpResponse)" should work as you would expect. I do most of my Django development interactively.

You can also drop the line "import pdb; pdb.set_trace()" in to any of your view functions when working with the development server to get an interactive Python debugger prompt at that line in your code - then you can interact with the request and response objects of your actual site on the command line. Just be VERY CAREFUL not to leave that line in when you deploy the site, as it will hang your web server. Installing http://pypi.python.org/pypi/ipdb gives you an IPython shell here with import ipdb; ipdb.set_trace().

I wrote a bunch of tips on debugging Django a few years ago: http://blog.simonwillison.net/po...

See question on Quora

Posted on 9 February 2012

Play Framework, Django or Rails? Which one do you recommend for Social Networking Web applications.


Both Rails and Django have been used for a large number of high profile social networking web applications. Off the top of my head, Django is used by Instagram and Pinterest, Rails is used by Posterous and Ravelry. I don't know what the largest sites built using Play are at the moment.

The hard problems involved in building a social network are essentially framework-agnostic: things like scaling an activity feed and running queries against large social graphs are solved by smart application architecture, not built-in framework functionality. Whether you use Rails, Django or Play will have almost no effect on how you solve those larger architectural challenges.

Pick the one you are most comfortable working with and start worrying about your site's functionality rather than its application framework.

See question on Quora

Posted on 14 January 2012

What are the benefits of developing in node.js versus Python?


Maybe there are none? I know that sounds like a troll, but you should consider it as a possibility. A lot is made of Node's asynchronous nature, but you can do event-driven apps in Python (and many other languages as well). It's not that hard, there is no magic.

Of course if you really love JavaScript programming then obviously Node has an advantage there. That's purely subjective though. Most programmers that I have worked with are pretty good at using different programming languages for different tasks.

Pragmatically there are some disadvantages as well. Being a younger language, you can expect more bugs, less documentation, and missing pieces. Of course all of these things are getting better all the time and there is an active community around Node. There's also a very active community around Python, Django, Twisted, etc. as well. In exchange for those bugs you get to use a technology that is considered very hip currently. You get "credibility" with some kinds of people. It's like Rails circa 2006-2007. If that kind of stuff matters to you, then that would be a huge advantage.

See question on Quora

Posted on 27 December 2011

I want to learn to code Python and Django (web framework). What's the best way to start for a programming newbie?


Although I think Python is a better overall language, if you just want to slap a utilitarian web interface on some backend code for internal use then PHP might be a better language to learn. It's easier to setup on the server, will run on virtually any host, and is a more out of the box solution.

As for Python/Django:

If you have never programmed before, it's definitely worth learning Python before you get to Django. Someone with experience could skip to a Django book/tutorial and pickup Python on the way - it's a simple language with very clear, easy to read and understand code.

How long it takes you to learn what you need to know is highly variable. If you are just trying to write some automation scripts to help cut down some manual labor, then you can probably go from zero to this point in a few weeks (maybe 20-30 hours). If you want to write production quality web apps using Python/Django, it's going to take longer.

Setup The Environment

First download Python if you don't have it. http://www.python.org/getit/ I prefer Linux, but your MacBook will be more than sufficient as a dev machine.

Python is in a state of limbo between the 2.7 release version and 3. While 3 is the future, it introduces some intrinsic changes which many of the popular libraries do not yet support, Django included. Your best bet is to start with 2.7 and switch to Python 3 later. Also, most of the learning material available is still written for Python 2.

You can write code in any text editor. My favorite, and an up-and-coming basic code editor is Sublime Text. It is simple, elegant, and very functional. http://www.sublimetext.com/ It costs $59, but you can use it free for an unlimited amount of time (as of right now). Well worth buying though.

Many Mac developers love and swear by TextMate. It's more developed and further along than Sublime, I think. Costs $54, and has a 30-day trial.

If you get deeper into programming and want a full featured integrated development environment (IDE), then PyCharm is top notch. http://www.jetbrains.com/pycharm/ It costs $99 and has a yearly renewal fee for updates, but is worth it. Something like this has a much steeper learning curve than Sublime Text or TextMate, but they can save you time and keystrokes in the long run.

I'm going to assume you are familiar with working in the terminal, since you have IT experience. If not, this might be a good starting point: http://smokingapples.com/softwar...

Django apps can be run entirely on your own dev machine, but if you want to put it on the web to be accessed by others on your team, or from other machines you will need a host. There are some good questions on Quora about hosts, but ensure you choose one that allows Python and SSH access. I recommend finding a cheap Virtual Private Server (VPS), although this might be too steep a learning curve for someone without experience. (You say you've done a lot in the IT field, so some of this might be too basic for you, sorry).

I recommend learning and using Source Control. This helps manage your code revisions, and is particularly useful if you have more than one person working on it. I personally use Mercurial, but Git is more popular.

http://hginit.com/ is a good intro guide for Mercurial. http://learn.github.com/p/intro.... looks to be good for Git, but I haven't worked through it yet.

In addition to using Source Control, you'll need a source code repository (you'll learn what this means in one of those tutorials. GitHub (http://www.github.com) is the most popular, with BitBucket (http://www.bitbucket.org) coming in second. You can use Git on either, but GitHub does not support Mercurial. Also, BB has better options for free accounts - unlimited free repos, whereas GitHub limits you.

You might feel overwhelmed trying to learn how to program Python, learning Django, and trying to figure out source control and a myriad of tools all at once. In my opinion it's best to get down a version control workflow early on, rather than putting it off. You'll develop good habits early on that will help you down the stretch.

Where to Learn
There are a ton of resources for learning Python, and quite a few for Django. Be sure that whatever you choose, you go with resources that consistently use either Python 2 or 3. Also, stay away from small tutorials and stick with complete references. Learning from piecemeal tutorials will leave you with fragmented knowledge, and they are usually lower quality.

Here is a list of references taken from another Quora question. The key to learning how to program, in my opinion, is to practice a lot. So do the exercises these books contain, and do more programming on your own.

Online Tutorials & Ebooks
All free

Recommended: http://www.diveintopython.net/
http://docs.python.org/tutorial/
http://swaroopch.com/notes/Python
http://homepage.mac.com/s_lott/b...
Recommended: http://greenteapress.com/thinkpy... (A higher level look at programming with Python as the tool; highly recommended if you want to be a good programmer)
http://python.net/~goodger/proje...
http://learnpythonthehardway.com/

Videos

http://code.google.com/edu/langu...
http://www.youtube.com/user/then...
Recommended: http://ocw.mit.edu/courses/elect... (A higher level look at programming with Python as the tool; highly recommended if you want to be a good programmer)

Books
Sometimes having a physical book makes it easier for some people to learn. Many of the above ebooks are available in hard copy.

Dive Into Python
Think Python
Learn Python the Hard Way
A Byte of Python

How do I learn Python?

All of those are Python references. The online material available for Django is more sparse, but there are some good resources.

The Django Book is the starting point for most people: http://www.djangobook.com/

There is, of course, the official tutorial: https://docs.djangoproject.com/e... I found Django Book more useful. However, get very familiar with the Django docs. They are very good, and you will be spending a lot of time digging into them.

This is a highly recommended hardcopy book for learning, but I've not used it: https://www.packtpub.com/django-...

Prefer video? This series ought to be very good: http://teamtreehouse.com/library... I have not tried it yet either. There is a $25/mo fee for their service

Getting Assistance
Inevitably, when you are learning or attempting to build something, you're going to run into a brick wall at some point.

This is my workflow if I get stuck on a concept, or while programming:
Check the Documentation -> Check the Source Code -> Search Google -> Ask on StackOverflow

Asking is always a last resort, quite simply because figuring it out on my own gives more of a sense of pride and accomplishment, and I'm more likely to remember the solution.

Python Docs: http://docs.python.org/
Django Docs: https://docs.djangoproject.com/e...

See question on Quora

Posted on 15 December 2011

I want to learn to code Python and Django (web framework). What's the best way to start for a programming newbie?


I worked at the newsroom where the Django framework was created, and I wrote an introduction to the framework a few years ago. It gives a brief history, overview, and links to various material on Django that would help you.

http://www.innovativeinteractivi...

As far as SEO goes, I would imagine that you would want to be most familiar with the template layer to create <title> and <meta description=""> tags, the Sitemaps app, and human-readable URLs.

See question on Quora

Posted on 14 December 2011

Should I learn Ruby/Rails, Python/Django, or Scala/Lift?


RoR. Some reasons:
  • it's the current reference for what a Web framework should be. All other frameworks are compared to it; a well-rounded developer can safely skip Django and hold out on Lift, but should have some Rails
  • it's definitely not a bad tool for a whole class of tasks, with large production mileage and a good-size eco-system
  • you can get a job doing it

Lift is very interesting if you're curios. I don't know enough Django to recommend it or not, but it's nowhere near Rails' adoption levels.

See question on Quora

Posted on 1 June 2011

Should I learn Ruby/Rails, Python/Django, or Scala/Lift?


I learned Rails before learning CakePHP. One thing I noticed, learning Rails makes it easier for transitioning to a different web framework in a different programming language which tries to copy what Rails is doing.

Currently I'm picking up Clojure while playing around with Conjure. If I need to code in Groovy maybe I'll use Grails?.

Seems like everybody's trying to follow 'the Rails way'. Personally I think it's good to get to know Rails and Django, it doesn't hurt.

See question on Quora

Posted on 24 May 2011

What web server suits Django best?


I'm still a big fan of a stripped down Apache+mod_wsgi running behind nginx.

Nginx handles static files, gzip, trickling to slow clients, load balancing and having a configuration language that's actually pleasant to work with.

Apache just sits there serving up dynamic Python pages via mod_wsgi, using the shortest possible config.

The reason I like Apache for this is I don't need to babysit the process at all, unlike if I was using FastCGI or running a separate Python app server.

See question on Quora

Posted on 25 January 2011

What are the benefits of developing in node.js versus Python?


  • You can use the same language for both client and server development.
  • The Chrome V8 engine: this is the single biggest selling point . There are many optimizations in the V8 engine ( most notably hidden classes and inline caching) that put it head and shoulders above any other dynamic language implementation [1].
  • Javascript as a language with closures is well suited for callback centric asynchronous programming.

[1] http://shootout.alioth.debian.or...

See question on Quora

Posted on 6 January 2011

What are the benefits of developing in node.js versus Python?


I see three major "wins" that Node.js has over most other development environments (including Python):

  1. It's built to handle asynchronous I/O from the ground up. Other environments have async. I/O features, but Node's the first environment where it's really pervasive. In most environments you'll find only limited pieces available in async. flavors, but in Node everything (or nearly everything) is async.-only. It's actually hard to write non-async. code in Node!

    Now, there's some debate over whether async. programming is really the silver bullet some claim it is, but in my mind there's little doubt that it's a really good match to a lot of common web- and network-development problems.
  2. It's "just JavaScript." Every time I  context switch between Python on the backend and JavaScript on the frontend I waste stupid amounts of time making silly syntax errors — semicolons in my Python, missing braces in my JavaScript, etc. Some days I might switch a dozen or more times, and it really feels like I'm wasting brain cycles swapping in and out my language knowledge. Staying in a single language feels faster.
  3. It's new, so it has the benefit of being able to learn from previous languages' and environments' mistakes. Better, Node can correct those mistakes without the backwards-compatibility concerns. For example, the Node package installer, npm, is already quite a bit better than many of its equivalents. All in all, Node feels very polished and modern; it hasn't had time to accumulate the cruft other languages/environments have.

    (Sadly, I'm all too sure it will accumulate this cruft eventually. Everything new feels old eventually.)

I highly recommend that you take the time to learn Node — it'll make you a better developer, whatever you end up using. I learned Node last year, and I'm very happy I did. It's a cool piece of software, and it's a great tool to have in your toolbox.

See question on Quora

Posted on 6 January 2011

What are the benefits of developing in node.js versus Python?


The 'V' and 'C' of MVC can be modeled well with Node.js. Since controllers route incoming requests and ideally shouldn't be doing more than that, the async nature of Node.js lends itself well for this purpose. The View part is obvious since browsers run Javascript anyways. Some immediate benefits would be single validation framework, pre-composition of initial content on the server side, and so on. There are full-fledged MVC frameworks, NoSQL modules, etc. on Node, but it is still too early to say if the speed of V8 engine alone is sufficient to thrust Javascript into server side development.

See question on Quora

Posted on 6 January 2011

What are the benefits of developing in node.js versus Python?


The benefits of developing in node.js are that it is a nascent community in which you can get a lot of credibility by being one of the (comparably) few websites using it.

You will also have the pleasure of writing a bunch of your own libraries to do things that you'd like to accomplish, which translates into complete customization for your product.

You also get a very active, quickly moving project to track (node.js), which means you can get your bug fixes in if necessary (or that things might change from under you).

If you're going to go down this route, I would at least suggest using coffeescript, as it hides several of the warts of the JS language.

EDIT: I no longer suggest coffeescript.

See question on Quora

Posted on 6 January 2011

As someone learning Python/Django, should I set up a local server on my Mac or should I just use Google App Engine?


Absolutely yes you should setup a local server. And by that, I mean simply run this command inside your project: ./manage.py runserver (I can't tell you how many times I type that every day...) then point your browser at http://localhost:8000/ and you should see the blank django page.

Follow the tutorial on djangoproject.com -- it's a very easy step by step way of getting started with Django.

And remember that Django is not Python and is certainly not App Engine. If you're just learning, there's no reason to put your stuff on a server -- just run it locally and learn that way. When you get to the point of wanting to post your project publicly, there are oodles of tutorials out there on how to do it.

In summary: stay away from GAE for now, run the local server, use sqllite for your database -- don't mess with setting up mysql, and don't forget that learning some good ol' fashioned python will be helpful along the way.

See question on Quora

Posted on 5 January 2011

What is the Heroku equivalent for Django applications?


Right this moment there's nothing for Django that's as easy as Heroku, so if you need something right now your choices are quite limited. There are, however, quite a few solutions being worked on, some of which offer private alpha/beta accounts. There are also a few DIY solutions worth looking at.

I'll go into more detail below:

If you need to deploy an app right this minute without much fuss I'd suggest WebFaction (http://webfaction.com/). They're the best option for cheap and easy Python deployment right now as they understand the problem space very well and offer excellent support. You also could consider Google's App Engine (http://code.google.com/appengine/), but note that you'll be quite limited in the parts of Django that'll run on App Engine.

If you're willing to wait a bit, I know of at least four Heroku-inspired Python/Django hosting solutions in the pipeline:


None of these services are fully available yet, so I can't really speak to their quality. However, most of them have pretty smart people behind them, so I fully expect they'll be pretty nice. It'll be a nice horse race on availability, features, and pricing -- good for users!

Finally, one DIY solution you might want to check out is Silver Lining (http://cloudsilverlining.org/). It's basically a DIY version of what the above services are trying to build -- you'll do a lot more yourself, probably, but not nearly as much as if you needed to build a server from scratch.

Good luck!

See question on Quora

Posted on 4 January 2011

What is the best Python web app framework? And why?


The two that stand out to me are Django and Pylons.

Pylons makes more sense if you want to invest a lot in doing custom work on your framework; Django might be a better choice if you want to make a site like a newspaper (or other traditional CMS product.)

cherrypy can be a good choice for very small projects.

They both have lots of documentation and lots of users and are easy to setup.

I put some time into researching this in the spring of 2009.  We chose Pylons because the different parts are easy to swap out.  For example, we didn't want to use a templating system, and it was easy to choose any templating system or just not use one with Pylons.  My impression was that it was slightly harder to do this in Django which has a tighter full stack integration.

If you want to use your web app framework as a CMS, Django is probably a better choice.  There are lots of convenient plug-ins and all the different pieces are setup to work up with each other so it's easy to build things that are similar to a newspaper really quickly with it, and it has lots of administration and account things built-in in a way that Pylons doesn't.

Ben Bangert, the creator of Pylons, has a somewhat informative discussion of Django vs. Pylons here.  http://stackoverflow.com/questio...

For small projects, I've used cherrypy sometimes, which isn't perfect but runs as a standalone webserver and requires very little boilerplate to setup.  Flask is a new framework that is gaining popularity and seems to fill the same niche but be a little bit more refined than cherrypy. ( http://flask.pocoo.org/ )

See question on Quora

Posted on 14 December 2009

reddit.com: search results

Today we released the 1.0.0 version of django-background-tasks

Today we released the 1.0.0 version of django-background-tasks which is an adopted and adapted version of the outdated and unmaintained django-background-task repository from John Montgomery.

To avoid conflicts on PyPI we renamed the package to django-background-tasks (plural). For an easy upgrade/migration from django-background-task to django-background-tasks, the internal module structure were extened but the API left untouched.

The new package has a full Django compatibility from version 1.4 LTS up to the new 1.8 LTS (Python 2 + 3) through django-compat. All relevant Pull Requests from the original repo where merged and new features added.

Please feel free to file any issues on the Github project page or contribute in any other way.

submitted by philippeowagner to django
[link] [16 comments]

Posted on 5 May 2015

what does django offer that rails doesnt?

hi all, i've asked the opposite question on the rails subreddit too, and i've so far got comfy with django, and now that i'm at a certain point of django, what is it about django that wouldy throw me off onto rails because it may be nicer to do on rails?

i like dango because its probably as popular, the docs are better i think, and of course python is used more than ruby (i think).

so make me stay on django!

submitted by a5myth to django
[link] [40 comments]

Posted on 23 February 2015

Django + Angular = Success?

Hey I want to know if someone already have a project which is based on Django in the Backend and AngularJS in the Frontend. How do you do that (I mean the project structure) and what were your experience with that?

Let the discussion begin :D

submitted by bykof to django
[link] [37 comments]

Posted on 7 February 2015

What is Django not good for?

Hi, I'm a couple months into Django and it is my first step into web development, and I was wondering what (kinds of websites?) is Django not so good for? If you could briefly explain why, and also what an alternative to Django might be in that instance that would be great. Thanks!

submitted by Caught_Up to django
[link] [47 comments]

Posted on 3 December 2014

The Django Tutorial: Dated and Confusing?

Hello Django Community! I'm curious to hear from Django users (experienced and new) in regards to your experience working through the tutorial, and then moving on to building your own project.

I've heard some people claim that the tutorial is "simple, straightforward, and all you need" to get running with Django. I've heard other say they were just as confused (or more so) after doing the tutorial as they were before doing it.

For me, I didn't fully understand Django until I learned Flask. Flask started at ground zero: a hello-world application. In 7 lines of code and two terminal commands a new user can have an application up and running. There's no discussion of ports, databases, or assumption that Flask is installed already. It takes a total noob, gets them up and running, and then starts things off in an easy-to-read format. There's even a separate forward for experienced programmers.

Once I had deployed a Flask project and tried Django again, I finally understood what was actually going on in Django (and its strong points). Now, after using both for many projects (both large and small), I thought I'd ask: Do you think the Django tutorial needs a rewrite? If so, what would you do to change it? I'm also curious to know what your experience with web development, python development, and MVC was before you started learning Django.

My opinion: The Django Documentation direly needs an overhaul to appeal to the MVC/MTV/Python framework noob. It simply introduces too much, too fast. Sure, the Admin is cool...but does it belong in the tutorial? Sure, a HUGE part of Django is the ORM/models...but do we really need to start talking about databases before introducing other parts of the framework?

On page one of the tutorial, the new user is instantly hit with Database setup, creating models, migrations, and the python shell. On page two, we completely switch gears and play with the admin. Finally, on page 3, we talk about views and actually displaying our own content on the front-end. It's true, Django is a HUGE framework when compared to Flask. But is it really appropriate to drown the new user in so much, so quickly?

submitted by rnevius to django
[link] [31 comments]

Posted on 27 October 2014

We are the authors of High Performance Django. Ask Us Anything!

Hi r/django! We recently published High Performance Django and are having a live Q&A session this Thursday, October 16th at 19:30 UTC. We'll be taking questions from IRC (#lincolnloop on Freenode), Twitter (use #hpdjango) or here and answering them on a live Google Hangout. Fire away with any questions you have about Django, deployment, scaling, etc. and we'll do our best to answer them!

You can tune in at https://highperformancedjango.com/live/

submitted by ipmb00 to django
[link] [48 comments]

Posted on 14 October 2014

Lets just dream Django 2.0

This post is more for a little fun than anything else. The idea behind it is you create your wish list of features for Django 2.0 it can be as sensible or far out as you like.

Personally I would love to see complete support for nosql (kind of speaks for it self) I would also love to see a full wsgi server built into django something like gunicorn by default so deployment becomes a breeze (not that its really hard at the moment).

submitted by mattwritescode to django
[link] [60 comments]

Posted on 7 August 2014

You have all been a huge help to me in my Django journey, so I thought I'd share what you helped build

Around 13 months ago, I decide to learn Python and Django so I could start building some website ideas I had. Previously, I just knew HTML and CSS and was using the ExpressionEngine CMS to build sites. It served the purpose and was good enough I guess, but I couldn't customize anything as I didn't know PHP. I wanted to be able to make changes to the way the site worked so it would do what i wanted and not have to bend around what the CMS could do. So... after 13 months of work learning Python and Django well enough to feel like I could start on this site, I dove in and with a lot of help from you folks here, I've launched: http://www.golfledger.com.

It's a site where golf addicts like myself can signup, share, discover and discuss all things golf. Aside from being able to post links (the site uses beautifulsoup to scrape the url and return data), members can follow each other, favorite links, like links, report links, comment, and like comments. I built a basic reputation system into it that keeps track of points when each users does something on the site, i.e., submits a link or comments.

Some apps I used:

Thanks for looking!

submitted by dsizemore to django
[link] [25 comments]

Posted on 25 June 2014

Django VS. .NET

Hi, my client is asking me why we chose Django for his project and why it was a better choice against .NET I don't know .NET, can you help me explain why (and if) Django was actually a better choice than .NET for their website? Can you post some "literature" about the argument? To better understand the project, consider it is a custom CMS, totally built on AJAX requests.

submitted by carusog to django
[link] [52 comments]

Posted on 17 March 2014

Django Unchained. Dr. King Schultz being a Dentist explained.

In Django, one of our heros Christopher Walt'z' Dr. King Schultz at one point was a Dentist-which seems like a strange offbeat choice to have a character have that as an occupation at first. Dig a little deeper and start looking at the naming conventions of the film.

You have Dr. King Schultz, a third party outsider who's current job is to thwart the evils at hand and the spreading issue of racism and slavery running rampant throughout the south.

Fine- he used to be a Dentist- whatever- this is Tarantino right? He's wrought with quirky decision making.

But then take a look at who he's first hunting; The Brittle Brothers. Aside from a few things, the only thing that comes to mind when I hear the word Brittle is sweet sugary Brittle Candy- as in Peanut Brittle and Caramel brittle, all syrup cooked to sweet perfection. He finds and eradicates them with the help of freed slave Django, only to name his next target; Calvin Candie- owner of "Candie Land" In short- the south is an invented cavity laden cesspool. The infection of slavery is growing and Dr. King Schultz is the living remedy.

Not to mention to one look at Calvin Candie and you see-maybe more than anyone-is in need of a Dentist. He sucks down Coconut juice- pure, cavities causing straight cane sugar. So in context you see, He IS the cavity and Dr. Schultz is there to to eradicate him.

Tarantino uses the so-good but-so-bad for you analogy of candy as the infected spreading epidemic of slavery and racism in the south to highlight it's need to be stopped.

submitted by pgibso to FanTheories
[link] [59 comments]

Posted on 15 March 2013

What are your favorite django apps ?

I'll start with my own list:

I will add more later with links to projects repos (I'm on mobile right now)

Update:

Some have been quicker than me, but I'll list them anyway:

Those are some I developed and use frequently:

submitted by hhh333 to django
[link] [21 comments]

Posted on 23 June 2012

reddit, what is your favorite editor for Django projects?

Please specify operating system, software, price, addons etc. I'm having problem finding a texteditor for my OSX which has the correct markup. Which one do you use?

EDIT: Thanks for replies, didn't expect that much activity. I see there are a lot of diffrent editors currently in use by us Django developers. I'll try to tl;dr the comments:

submitted by lordlarm to django
[link] [57 comments]

Posted on 4 October 2010

The Onion Uses Django, And Why It Matters To Us

We wanted to post earlier why we like/use Django, but, we get pretty busy around here, so a bit late. Sorry if this is duping any existing threads.

Why

This is not a Drupal vs Django fight, we're not here to slag Drupal, Drupal has been important to The Onion, but The Onion decided to stop using Drupal a long time ago. The Onion deployed a Drupal site back in 2005, at the time it was the right decision given the resources, yet even then we were interested in using Python whenever possible. We feel it is a vastly better designed language than PHP and of course any framework you're using is only as good as the language. We started rolling out other projects, like The A.V. Club, in Django. Just this past weekend we switched over The Onion proper, and we're seeing immediate gains in speed, maintainability, and stability. As a team we have a pretty broad base of experience and I know we're all in agreement that what we've got now is better, enormously better. We're not just using Django, we have some other pieces that made our lives easier: git, PostgreSQL, VPS's. So this isn't just about The Onion using Django (and recommending it), but generally that you can make things better by investing time and energy into new technology.

How

It took us about 3 months to convert our old Onion site to Django while we also maintained and built on our other sites. We already had some components written for A.V. Club, including a strong article and image model, so we felt we could concentrate on coming up with good models that covered the necessary editorial cases. The hard part was more how to fit pieces of content from ten years ago consistently and cleanly than it was writing the code to make use of the final model. We broke out templates into nicely reusable components and made use of the Django template hierarchy. Multi-db made the conversion of data from a MySQL db to the PostgreSQL db fairly easy, so we could rerun importing old data into the new system and fix and tweak. There is an enormous advantage using Django, sorl and PIL for creating image crops based on templatetags which gives the editorial and design folk flexibility they need (no more css cropping odd-sized images into place). Again, lots of work went into actually cleaning a site that goes back to 1996, Django allowing for a relatively minimal amount of coding -- particularly when it comes to the admin side for content entry, Django trunk we found almost ready to go as-is (something we did not find with previous Django). That we could use the Django admin rather than create custom entry forms I think saved us 2 months work.

Because

Cleaner. Much cleaner. Proper unit testing. Real reusable components across applications. An ORM rather than a just a series of functional query helpers. Tighter conventions (q: how often do people using Python argue about bracing styles? a: they don't). We can update then test a Django core change without worrying about having to take apart our applications, and if we do need to make a change, it's easy to do because there's less, much more readable code. Every member of the tech team can meaningfully contribute because there are fewer specialized or hacked together pieces. We can move more quickly on large changes because of all these reasons. And we're more stable because of all the previously expressed points.

-- The Onion Tech Team

submitted by westononion to django
[link] [115 comments]

Posted on 24 March 2010