Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aa9ba21
commit e903846
Showing
4 changed files
with
125 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
============== | ||
Create a theme | ||
============== | ||
|
||
In this how-to you will learn how to create a theme for LFS. | ||
|
||
You can :download:`download the whole theme here <mytheme.tar.gz>`. | ||
|
||
Preparations | ||
============ | ||
|
||
First you have to create a new Django application. This is beyond the purpose | ||
of this tutorial and you should refer to `Django's excellent tutorial | ||
<http://docs.djangoproject.com/en/dev/intro/tutorial01/>`_ if you want to learn | ||
more. | ||
|
||
Add a templates folder and within that add a lfs folder. | ||
|
||
In short, your starting file structure should look like this:: | ||
|
||
mytheme | ||
__init__.py | ||
templates | ||
lfs | ||
|
||
Registration | ||
============ | ||
|
||
Register mytheme to Django's template engine. | ||
|
||
1. Move the mytheme folder to the PYTHONPATH. | ||
|
||
The easiest way to do that is to put it into the lfs_project folder of the | ||
buildout. | ||
|
||
2. Register the theme | ||
|
||
Add mytheme to INSTALLED_APPS **before** lfstheme:: | ||
|
||
INSTALLED_APPS = ( | ||
... | ||
"mytheme", | ||
"lfstheme", | ||
"django.contrib.admin", | ||
... | ||
|
||
Copy templates | ||
============== | ||
|
||
Now copy the templates you want to change into the lfs folder of mytheme and | ||
adapt them to your needs. | ||
|
||
**Important:** you have to keep the original path, e.g: base.html must be within | ||
the root of the lfs folder whereas the cart portlet (cart.html) must be within | ||
the portlets folder:: | ||
|
||
mytheme | ||
__init__.py | ||
templates | ||
lfs | ||
base.html | ||
portlets | ||
cart.html | ||
|
||
Use own CSS | ||
=========== | ||
|
||
To use own CSS several steps are neccessary (this is going to be improved a lot | ||
for future versions). | ||
|
||
1. Create a "static" folder within mytheme:: | ||
|
||
mytheme | ||
static | ||
... | ||
|
||
2. Within that create a new CSS-file, e.g. mytheme.css and add your CSS rules, e.g.:: | ||
|
||
.breadcrumbs li { | ||
color: red !important; | ||
} | ||
|
||
Alternatively you might copy main.css from lfstheme and adapt it to your | ||
needs. | ||
|
||
3. Go to the lfs_project/media folder and create a symbolic link to the | ||
static folder:: | ||
|
||
$ ln -s <path/to/buildout>/lfs_project/mytheme/static mytheme | ||
|
||
4. Copy base.html to mytheme/templates/lfs (if you haven't done it so far) | ||
|
||
5. Include your CSS file to the header:: | ||
|
||
<link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}mytheme/mytheme.css"> | ||
|
||
6. Optionally delete the link to main.css (if you just want to use your own CSS). |
Binary file not shown.
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 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,49 +1,54 @@ | ||
.. index:: Installation | ||
|
||
============ | ||
Installation | ||
============ | ||
|
||
Prequisites | ||
----------- | ||
=========== | ||
|
||
Make sure you have installed: | ||
|
||
* Python 2.6.x http://www.python.org/download/ | ||
* sqlite http://www.sqlite.org/download.html | ||
* mercurial http://mercurial.selenic.com/wiki | ||
* git http://git-scm.com/ | ||
|
||
|
||
Please note: | ||
|
||
* The dependency of mercurial and git will be disappear in near future. | ||
* You can - of course - use another database but we provide a filled sqlite | ||
* The dependency of mercurial will be disappear in near future. | ||
* You can - of course - use another database but we provide a pre filled sqlite | ||
database for convenience. | ||
|
||
Installation | ||
------------ | ||
============ | ||
|
||
The installation is straightforward and should last just a few minutes. | ||
|
||
1. Get the installer: hg clone http://bitbucket.org/diefenbach/lfs-buildout-quickstart/ | ||
2. cd lfs-buildout-quickstart | ||
1. Get the installer: hg clone http://bitbucket.org/diefenbach/lfs-buildout-development/ | ||
2. cd lfs-buildout-development | ||
3. python bootstrap.py | ||
4. customize your buildout.cfg | ||
- e.g. if you want to use postgresql as backend db just replace "sqlite3" with "psycopg2" in the "eggs" section under the "[django]" part; | ||
- *NOTE: if you feel fine with using sqlite or you don't need any customization you can skip this step* | ||
- *NOTE: to learn more about using 'buildout' go to http://www.buildout.org/docs/index.html* | ||
5. bin/buildout -v | ||
6. if you are using sqlite skip this step, otherwise execute this: | ||
- bin/django loaddata path/to/your/eggs/django_lfs-xxx/lfs/core/fixtures/lfs_initial.xml | ||
7. bin/django syncdb | ||
8. Start the server: bin/django runserver | ||
|
||
Now open your browser and visit: | ||
4. bin/buildout -v | ||
5. bin/django runserver | ||
|
||
Now open your browser and visit: | ||
|
||
* The frontend: http://localhost:8000/ | ||
* The management interface: http://localhost:8000/manage | ||
|
||
That's all! | ||
|
||
Optionally | ||
========== | ||
|
||
If you want to use postgresql (for instance) as backend db just replace "sqlite3" with "psycopg2" in the "eggs" section under the "[django]" part | ||
|
||
.. NOTE:: to learn more about using 'buildout' go to http://www.buildout.org/docs/index.html | ||
|
||
If you are using another database then the provided sqlite you may want to synchronize and initialize it:: | ||
|
||
$ bin/django syncdb | ||
$ bin/django loaddata path/to/your/eggs/django_lfs-xxx/lfs/core/fixtures/lfs_initial.xml | ||
|
||
What's next? | ||
------------ | ||
Move on to :doc:`/user/getting_started`. | ||
============ | ||
Move on to :doc:`getting_started`. |