forked from django-oscar/django-oscar
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated documentation - still not complete but much better
- Loading branch information
1 parent
fe4bcd5
commit 9727c70
Showing
20 changed files
with
681 additions
and
206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,76 +1,171 @@ | ||
=============== | ||
Getting started | ||
============================ | ||
Start building your own shop | ||
============================ | ||
|
||
For simplicity, let's assume you're building a new e-commerce project from | ||
scratch and have decided to use Oscar. Let's call this shop 'frobshop' | ||
|
||
.. tip:: | ||
|
||
You can always review the set-up of the `Sandbox site`_ in case you have | ||
trouble following the below instructions. | ||
|
||
.. _`Sandbox site`: https://github.com/tangentlabs/django-oscar/tree/releases/0.2/sandbox | ||
|
||
Install by hand | ||
=============== | ||
|
||
Install using:: | ||
Install oscar (which will install Django as a dependency), then create the | ||
project:: | ||
|
||
pip install django-oscar | ||
django-admin.py startproject frobshop | ||
|
||
This will create a folder ``frobshop`` for your project. | ||
|
||
Settings | ||
-------- | ||
|
||
Now edit your settings file ``frobshop.frobshop.settings.py`` to specify a | ||
database (we use sqlite for simplicity):: | ||
|
||
DATABASES = { | ||
'default': { | ||
'ENGINE': 'django.db.backends.sqlite3', | ||
'NAME': 'db.sqlite3', | ||
'USER': '', | ||
'PASSWORD': '', | ||
'HOST': '', | ||
'PORT': '', | ||
} | ||
} | ||
|
||
then add ``oscar.apps.basket.middleware.BasketMiddleware`` to ``MIDDLEWARE_CLASSES``, and | ||
set ``TEMPLATE_CONTEXT_PROCESSORS`` to:: | ||
|
||
TEMPLATE_CONTEXT_PROCESSORS = ( | ||
"django.contrib.auth.context_processors.auth", | ||
"django.core.context_processors.request", | ||
"django.core.context_processors.debug", | ||
"django.core.context_processors.i18n", | ||
"django.core.context_processors.media", | ||
"django.core.context_processors.static", | ||
"django.contrib.messages.context_processors.messages", | ||
'oscar.apps.search.context_processors.search_form', | ||
'oscar.apps.promotions.context_processors.promotions', | ||
'oscar.apps.checkout.context_processors.checkout', | ||
'oscar.core.context_processors.metadata', | ||
) | ||
|
||
Next, modify ``INSTALLED_APPS`` to be a list, add ``South`` and append Oscar's core apps:: | ||
|
||
then add:: | ||
from oscar import get_core_apps | ||
INSTALLED_APPS = [ | ||
'django.contrib.auth', | ||
... | ||
'south', | ||
] + get_core_apps() | ||
|
||
'oscar.apps.basket.middleware.BasketMiddleware' | ||
and set your auth backends to:: | ||
|
||
to ``MIDDLEWARE_CLASSES``, and:: | ||
AUTHENTICATION_BACKENDS = ( | ||
'oscar.apps.customer.auth_backends.Emailbackend', | ||
'django.contrib.auth.backends.ModelBackend', | ||
) | ||
|
||
'oscar.apps.promotions.context_processors.promotions', | ||
'oscar.apps.checkout.context_processors.checkout', | ||
to allow customers to sign in using an email address rather than a username. | ||
|
||
to ``TEMPLATE_CONTEXT_PROCESSORS``. Next, add the following apps | ||
to your ``INSTALLED_APPS``:: | ||
Oscar currently uses Haystack for search so you need to specify:: | ||
|
||
'oscar', | ||
'oscar.apps.analytics', | ||
'oscar.apps.discount', | ||
'oscar.apps.order', | ||
'oscar.apps.checkout', | ||
'oscar.apps.shipping', | ||
'oscar.apps.order_management', | ||
'oscar.apps.catalogue', | ||
'oscar.apps.catalogue.reviews', | ||
'oscar.apps.basket', | ||
'oscar.apps.payment', | ||
'oscar.apps.offer', | ||
'oscar.apps.address', | ||
'oscar.apps.partner', | ||
'oscar.apps.customer', | ||
'oscar.apps.promotions', | ||
'oscar.apps.reports', | ||
'oscar.apps.search', | ||
'oscar.apps.voucher', | ||
HAYSTACK_SITECONF = 'oscar.search_sites' | ||
HAYSTACK_SEARCH_ENGINE = 'dummy' | ||
|
||
Add:: | ||
The last addition to the settings file is to import all of Oscar's default settings:: | ||
|
||
from oscar.defaults import * | ||
|
||
to your ``settings`` module and run:: | ||
URLs | ||
---- | ||
|
||
Alter your ``frobshop/urls.py`` to include Oscar's URLs:: | ||
|
||
from django.conf.urls import patterns, include, url | ||
from oscar.app import shop | ||
|
||
urlpatterns = ('', | ||
(r'', include(shop.urls)) | ||
) | ||
|
||
Database | ||
-------- | ||
|
||
Then create the database and the shop should be browsable:: | ||
|
||
python manage.py syncdb --noinput | ||
python manage.py migrate | ||
|
||
You should now have a running Oscar install that you can browse. | ||
|
||
|
||
Install using Tangent's boilerplate django project | ||
================================================== | ||
|
||
The easiest way to get started is to use Tangent's `template django project`_ | ||
although it is tailored to an Agency structure which may not suit everyone. | ||
|
||
.. `template django project`: https://github.com/tangentlabs/tangent-django-boilerplate | ||
Set up a virtualenv, and create a new project using the ``startproject`` | ||
management command:: | ||
|
||
mkvirtualenv frobshop | ||
pip install Django | ||
django-admin.py startproject frobshop \ | ||
--template=https://github.com/tangentlabs/tangent-django-boilerplate/zipball/master | ||
|
||
python manage.py syncdb | ||
This will create a folder ``frobshop`` which is an entire templated project that | ||
follows Tangent's conventions. The structure is: | ||
|
||
to create the database tables. | ||
frobshop/ | ||
docs/ | ||
www/ | ||
conf/ | ||
deploy/ | ||
public/ | ||
static/ | ||
templates/ | ||
manage.py | ||
settings.py | ||
settings_test.py | ||
urls.py | ||
urls_oscar.py | ||
README.rst | ||
fabconfig.py | ||
fabfile.py | ||
deploy-to-test.sh | ||
deploy-to-stage.sh | ||
deploy-to-prod.sh | ||
|
||
Replace a few files with Oscar-specific versions:: | ||
|
||
Demo shop | ||
--------- | ||
mv frobshop/www/urls{_oscar,}.py | ||
mv frobshop/www/deploy/requirements{_oscar,}.py | ||
mv frobshop/www/conf/default{_oscar,}.py | ||
|
||
A demo shop is in preparation at the moment and will be available soon. | ||
Install dependencies:: | ||
|
||
Real shop | ||
--------- | ||
cd frobshop/www | ||
pip install -r deploy/requirements.txt | ||
|
||
Sadly, setting up an e-commerce store is never trivial as you would like. At a | ||
minimum, you'll have to consider the following questions: | ||
Create database:: | ||
|
||
* How are shipping charges calculated? | ||
* How are products organised into categories? | ||
* How are stock messages determined? | ||
* How is payment taken at checkout? | ||
* How are orders fulfilled and managed? | ||
* How is stock and inventory updated? | ||
python manage.py syncdb -noinput | ||
python manage.py migrate | ||
|
||
Much of the documentation for oscar is organised as recipes that explain | ||
how to solve questions such as those above: | ||
And that should be it. | ||
|
||
* :doc:`recipes/how_to_customise_an_app` | ||
* :doc:`recipes/how_to_customise_models` | ||
* :doc:`recipes/how_to_override_a_core_class` | ||
Next steps | ||
========== | ||
|
||
The next step is to implement the business logic of your domain on top of | ||
Oscar. |
Oops, something went wrong.