Beginning Django E Commerce
398 pág.

Beginning Django E Commerce


DisciplinaProgramação I24.723 materiais281.549 seguidores
Pré-visualização50 páginas
advantages 
over their competition. 
So what does this have to do with creating your own e-commerce site from scratch? Think about it 
this way: let\u2019s imagine that you have a store that sells oversized stuffed animals. You sell a lot of them in 
your store, mostly to people who run carnivals, and you want to take this business online, so you can sell 
to carnival employees all over the world. Now, there\u2019s a store right down the street from you, called Huge 
Stuffed Things, and they have an online store that they\u2019ve set up with Shopify, and business seems good 
for them. Huge boxes leave their store each day, presumably filled with huge stuffed animals, to ship to 
their online consumers. 
If you sign up with Shopify to start selling your large stuffed animals too, there will be a drastic limit 
to what you can do in order to compete with Huge Stuffed Things. Sure, maybe your store has a much 
better name that doesn\u2019t make it sound like a taxidermy shop for game hunters, but really, in this 
situation, the only way you can compete is through marketing and advertising. You can brand yourself 
better than they can, and spend lots more money on online marketing campaigns and get lots more 
traffic to your site. But at its core, the technology you\u2019re using (in this case, Shopify\u2019s platform) doesn\u2019t 
offer you any advantages over the other guys who are using the same platform, which trickles right 
down. Your site won\u2019t offer your customers any net benefit, either. 
Don\u2019t get me wrong, I\u2019m not knocking Shopify. Like I said, I like the interface, and there are many 
very successful sites that are run on its architecture. In addition to this, it can be quite useful for testing 
the waters. Do people really want to buy gift baskets filled with freeze-dried fruit they can give to their 
astronaut friends at NASA? Who knows? Set up a store on Shopify and see how many orders you get 
before you invest too much into the idea. I would encourage that. (And really, I admire Shopify because 
they\u2019re knocking down what are referred to in the business world as barriers to entry.) 
But for business, real business, you need to plan for growth, and a large part of that is starting your 
online application with a decent architecture that is your own, that you can later modify without limit, 
and that offers you benefits over your competitors. And if you happen to be entering a market where you 
have no competitors (what business are you in again?), then you either have a terrible idea (why is no 
one else doing it?), or you will end up with competition very quickly, especially if your venture meets 
with any success whatsoever. You want to be able to do things better than everyone else, and a key part 
of this lies in your technology. 
I\u2019m not saying that your own system will automatically bring you riches. If you consistently hire 
poor employees to work for you, or if your base idea is just plain bad, your own e-commerce platform 
probably won\u2019t spin your straw into gold. But the next big, Amazon.com-esque online merchant will not 
happen on a platform like Shopify. 
Throughout the course of this book, you will develop a piece of software that will help your process, 
and refine the day-to-day operations of your business, to the extent that you can use these savings or 
quality of service to offer real value to your customers. The purpose of this book is to show you the 
syntax, illustrate basic concepts, and cover most use cases, so that you can customize things to fit your 
own business model. 
www.it-ebooks.info
CHAPTER 1 \u25a0 BEST LAID PLANS 
 
4 
 
Why Django? 
I\u2019m going to use the Django web framework in this book, which was written in the Python programming 
language. Django is extremely easy to learn and use, and is very lightweight and straightforward, much 
like the language in which it\u2019s written. Choosing a technology to use to construct your site is a tough 
decision, because you\u2019re going to be stuck using it for a while. Even worse, early on, when you\u2019re forced 
to make a decision about what framework you\u2019re going to use, you have hardly any information about 
how well it\u2019s going to fare against your requirements. 
I enjoy Django, but syntactically, it\u2019s a little different than most of the other major players out there 
right now. There are a few things that I think makes Django a very good choice for web development that 
are not available in other frameworks that I know of. (Let\u2019s call them Django\u2019s \u201ccore competencies.\u201d) 
These include, but aren\u2019t limited to: 
The Django admin interface saves time: I think this alone is one reason to consider 
using Django as your web framework. The creators of Django recognized that just 
about everyone using web pages creates database tables to hold information, and 
then they must create an administrative interface to manage those records. With 
only a few small classes, Django creates these administrative forms for you in a 
slick and easy-to-use interface. It even handles the authentication for you, so only 
administrators have access to them. This saves you a lot of work and definitely 
lessens the grade of the learning curve. 
URL management is easy: Django allows you to handle how your URLs are 
formed at the application level and not the server level. This saves you from the 
headache of putting application logic into your apache conf file where is really 
doesn\u2019t belong. Nice URLs are also very SEO friendly. 
Python is fast: As a programming language, developing in Python is quick, and 
Python, despite being an interpreted language instead of a compiled one, is 
quick. This means that your development time and running time is also fast. 
Django is open source: Django is free to use. You\u2019re welcome to take it, extend it, 
modify it, and do anything that you\u2019d like to your heart\u2019s content, and you don\u2019t 
need to pay anybody a dime for it. More specifically, Django is available for free 
use and modification under the Berkeley Software Distribution (BSD) license,1 
which means that you can safely use it to build a web site and you can rest easy 
knowing that your use of Django won\u2019t ever result in a lawsuit. The main 
drawback to open source software is, of course, that what you save in software 
costs you may need to make up for in other opportunity costs, such as 
developer time. I think Django is easy enough to use, and there isn\u2019t a shortage 
of Python developers, so this probably won\u2019t be a problem for you. 
You\u2019ve picked up this book, so you\u2019ve probably already heard good things about Django, or Python, 
or both, and are interested in taking it for a test drive. I strongly encourage that, because I\u2019m sure that 
you\u2019ll be happy with both the process and the results. I\u2019m not a salesman; I\u2019m not going to echo the 
wealth of arguments that are out there on behalf of Django. Besides, the best solution for one 
application might not be the best solution for your own. It really depends on your own project\u2019s 
requirements. 
But I will say this: Django is done in Python, and Python was chosen by Google as the programming 
language to handle a lot of its dynamic web functionality. Google now employs Python\u2019s creator, Guido 
 
1 http://code.djangoproject.com/browser/django/trunk/LICENSE 
www.it-ebooks.info
CHAPTER 1 \u25a0 BEST LAID PLANS 
 
5 
 
van Rossum. Even if you don\u2019t have the time or desire to benchmark and test Python as one of your 
options, I\u2019m pretty sure the guys at Google did, pretty thoroughly. You can at least rest easy knowing that 
your decision is consistent with some of the most successful technical people in the world. 
Straying From the Django Philosophy 
One big selling point of Django is that it encourages modularity and portability in your web applications. 
For example, if you create a blog app in your web project, there are ways