|
|
@@ -1,51 +1,78 @@
|
|
|
1
|
+=======================================
|
|
1
|
2
|
Installing django-oscar for development
|
|
2
|
3
|
=======================================
|
|
3
|
4
|
|
|
4
|
|
-Set up `virtualenv` if you haven't already done so::
|
|
|
5
|
+Note that these instructions assume you are developing on Ubuntu.
|
|
|
6
|
+
|
|
|
7
|
+Virtual environment
|
|
|
8
|
+-------------------
|
|
|
9
|
+
|
|
|
10
|
+Set up ``pip`` and ``virtualenv`` if you haven't already done so::
|
|
5
|
11
|
|
|
6
|
12
|
sudo apt-get install python-setuptools
|
|
7
|
13
|
sudo easy_install pip
|
|
8
|
14
|
sudo pip install virtualenv virtualenvwrapper
|
|
9
|
|
- echo "source /usr/local/bin/virtualenvwrapper.sh" >> ~/.bashrc
|
|
|
15
|
+ echo "source `which virtualenvwrapper`" >> ~/.bashrc
|
|
10
|
16
|
|
|
11
|
|
-Note: Fedora (and possibly other Red Hat based distros) installs virtualenvwrapper.sh in /usr/bin path, so the last line above should read::
|
|
|
17
|
+Reload bash to add the virtualenvwrapper commands to your path::
|
|
12
|
18
|
|
|
13
|
|
- echo "source /usr/bin/virtualenvwrapper.sh" >> ~/.bashrc
|
|
|
19
|
+ . ~/.bashrc
|
|
14
|
20
|
|
|
15
|
|
-Reload bash with the following command::
|
|
|
21
|
+Create a virtualenv for developement::
|
|
16
|
22
|
|
|
17
|
|
- ~/.bashrc
|
|
18
|
|
-
|
|
19
|
|
-Do the following from your workspace folder::
|
|
20
|
|
-
|
|
21
|
|
- mkdir oscar
|
|
22
|
|
- cd oscar
|
|
23
|
23
|
mkvirtualenv --no-site-packages oscar
|
|
24
|
24
|
workon oscar
|
|
|
25
|
+
|
|
|
26
|
+Forking django-oscar
|
|
|
27
|
+--------------------
|
|
|
28
|
+
|
|
|
29
|
+Sign in to github, navigate to https://github.com/tangentlabs/django-oscar and click "Fork". This will create a
|
|
|
30
|
+copy of the repository in your account.
|
|
|
31
|
+
|
|
|
32
|
+Now clone the remote repository to your machine::
|
|
|
33
|
+
|
|
|
34
|
+ cd workspace
|
|
|
35
|
+ git clone git@github.com:username/django-oscar.git
|
|
25
|
36
|
|
|
26
|
|
-After checking out your fork, install the latest version of Django into your virtualenv (currenty a beta of 1.3)::
|
|
|
37
|
+See the github guide to forking for more details (http://help.github.com/fork-a-repo/).
|
|
27
|
38
|
|
|
28
|
|
- pip install django
|
|
|
39
|
+Install django-oscar and dependencies
|
|
|
40
|
+-------------------------------------
|
|
29
|
41
|
|
|
30
|
|
-Install all packages from the requirements file (optional)::
|
|
|
42
|
+Install django and the packages from the requirements file, which aren't essential but are useful
|
|
|
43
|
+for testing and development::
|
|
31
|
44
|
|
|
|
45
|
+ pip install django
|
|
32
|
46
|
pip install -r requirements-dev.txt
|
|
33
|
47
|
|
|
34
|
|
-This just provides some useful tooling for developing a django project - the installed
|
|
35
|
|
-modules are not mandatory to run oscar.
|
|
36
|
|
-
|
|
37
|
|
-Install oscar in development mode within your virtual env::
|
|
|
48
|
+Install oscar in development mode within your virtualenv::
|
|
38
|
49
|
|
|
|
50
|
+ cd django-oscar
|
|
39
|
51
|
python setup.py develop
|
|
40
|
52
|
|
|
41
|
53
|
Note: In case of gcc crashing and complaining in-between installation process,
|
|
42
|
54
|
make sure you have appropriate -devel packages installed (ie. mysql-devel) in
|
|
43
|
55
|
your system.
|
|
44
|
56
|
|
|
45
|
|
-Now create a `local_settings.py` file which contains details of your local database
|
|
46
|
|
-that you want to use for development. Be sure to create two databases: one for development
|
|
47
|
|
-and one for running the unit tests (prefix `test_` on the normal db name).
|
|
|
57
|
+Now create a ``settings_local.py`` file which contains details of your local database
|
|
|
58
|
+that you want to use for development. At a minimum, this needs to define the ``DATABASES`` tuple.
|
|
|
59
|
+
|
|
|
60
|
+Developing
|
|
|
61
|
+----------
|
|
|
62
|
+
|
|
|
63
|
+Developing oscar normally involves working on a django project which uses oscar
|
|
|
64
|
+as a installed app. There are several such projects within the ``examples`` folder:
|
|
|
65
|
+
|
|
|
66
|
+* The ``vanilla`` project does not customise oscar at all and uses everything in its
|
|
|
67
|
+ default format. It represents a blank canvas for an ecommerce shop.
|
|
|
68
|
+* The ``demo`` project does customise oscar, and is intended to demonstrate the range
|
|
|
69
|
+ of features in oscar.
|
|
|
70
|
+
|
|
|
71
|
+Each example shop has its own ``manage.py`` executable which you can use to create
|
|
|
72
|
+your database::
|
|
48
|
73
|
|
|
|
74
|
+ ./manage.py syncdb
|
|
|
75
|
+
|
|
49
|
76
|
Install sample data
|
|
50
|
77
|
-------------------
|
|
51
|
78
|
|
|
|
@@ -55,30 +82,20 @@ following commands::
|
|
55
|
82
|
cd examples/vanilla
|
|
56
|
83
|
./manage.py import_catalogue ../sample-data/books.csv
|
|
57
|
84
|
./manage.py import_images ../sample-data/book-images/
|
|
58
|
|
- ./manage.py update_index
|
|
59
|
|
-
|
|
60
|
|
-
|
|
61
|
|
-Developing
|
|
62
|
|
-----------
|
|
63
|
|
-
|
|
64
|
|
-Developing oscar normally involves working on a django project which uses oscar
|
|
65
|
|
-as a installed app. There are several such projects within the `examples` folder - the
|
|
66
|
|
-`defaultshop` project does not customise oscar at all and uses everything in its
|
|
67
|
|
-default format.
|
|
68
|
|
-
|
|
69
|
|
-Each example shop has its own `manage.py` executable which you can use to create
|
|
70
|
|
-your database::
|
|
71
|
|
-
|
|
72
|
|
- ./manage.py syncdb
|
|
|
85
|
+ ./manage.py update_index
|
|
|
86
|
+
|
|
|
87
|
+
|
|
|
88
|
+Helper scripts
|
|
|
89
|
+--------------
|
|
73
|
90
|
|
|
74
|
91
|
There is a shortcut script for dropping all of a projects's apps and rerunning `syncdb` in
|
|
75
|
92
|
the `examples` folder - you need to specify which project to act on::
|
|
76
|
93
|
|
|
77
|
|
- ./recreate_project_tables.sh defaultshop
|
|
|
94
|
+ ./recreate_project_tables.sh vanilla
|
|
78
|
95
|
|
|
79
|
96
|
There is a similar script for running tests::
|
|
80
|
97
|
|
|
81
|
|
- ./run_tests.sh defaultshop
|
|
|
98
|
+ ./run_tests.sh vanilla
|
|
82
|
99
|
|
|
83
|
100
|
This specifies a sqlite3 database to use for testing and filters out the useless output.
|
|
84
|
101
|
|