Commit ad51dd95 authored by O'Reilly Media, Inc.'s avatar O'Reilly Media, Inc.
Browse files

Initial commit

parents
Loading
Loading
Loading
Loading

README.md

0 → 100644
+15 −0
Changes for README.md: 15 added lines, 0 removed lines.
Original line number Diff line number Diff line
## Example files for the title:  
	  
# Django Design Patterns and Best Practices, by Arun Ravindran
	  
[![Django Design Patterns and Best Practices, by Arun Ravindran](http://akamaicovers.oreilly.com/images/9781783986651/cat.gif)](https://www.safaribooksonline.com/)
	  
The following applies to example files from material published by O’Reilly Media, Inc. Content from other publishers may include different rules of usage. Please refer to any additional usage rights explained in the actual example files or refer to the publisher’s website.
	  
O'Reilly books are here to help you get your job done. In general, you may use the code in O'Reilly books in your programs and documentation. You do not need to contact us for permission unless you're reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from our books does not require permission. Answering a question by citing our books and quoting example code does not require permission. On the other hand, selling or distributing a CD-ROM of examples from O'Reilly books does require permission. Incorporating a significant amount of example code from our books into your product's documentation does require permission.
	  
We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN.
	  
If you think your use of code examples falls outside fair use or the permission given here, feel free to contact us at <permissions@oreilly.com>.
	  
Please note that the examples are not production code and have not been carefully testing. They are provided "as-is" and come with no warranty of any kind.

logo.png

0 → 100644
+10.6 KiB
Loading image diff...
+56 −0
Changes for superbook-master/.gitignore: 56 added lines, 0 removed lines.
Original line number Diff line number Diff line
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Packaging files:
*.egg*

# Sphinx docs:
build

# SQLite3 database files:
*.db
*.sqlite3
*.sqlite

# Logs:
*.log

# Environment variables
# *.env

# Django stuff:
*.mo
*.pot

# Eclipse
.project
.pydevproject
.settings

# Linux Editors
*~
\#*\#
/.emacs.desktop
/.emacs.desktop.lock
.elc
auto-save-list
tramp
.\#*
*.swp
*.swo

# Rope
.ropeproject

# Mac
.DS_Store
._*

# Windows
Thumbs.db
Desktop.ini
+22 −0
Changes for superbook-master/LICENSE.txt: 22 added lines, 0 removed lines.
Original line number Diff line number Diff line
Copyright (c) 2014 Arun Ravindran

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
+130 −0
Changes for superbook-master/README.md: 130 added lines, 0 removed lines.
Original line number Diff line number Diff line
# SuperBook

SuperBook is a social network for superheroes built with [Python][0] using the [Django Web Framework][1].

## Chapters

These are the chapters containing Django code samples from the book 'Django Design Patterns and Best Practices' by Arun Ravindran:

*  [Chapter 3](https://github.com/DjangoPatternsBook/superbook/tree/chapter03)
*  [Chapter 4](https://github.com/DjangoPatternsBook/superbook/tree/chapter04)
*  [Chapter 5](https://github.com/DjangoPatternsBook/superbook/tree/chapter05)
*  [Chapter 6](https://github.com/DjangoPatternsBook/superbook/tree/chapter06)
*  [Chapter 7](https://github.com/DjangoPatternsBook/superbook/tree/chapter07)
*  [Chapter 9](https://github.com/DjangoPatternsBook/superbook/tree/chapter09)

# Installation

The installation instructions have been split into the following sections:

* Creation of a new Virtual Environment (read your OS-specific section)
* Installation of the superbook project (common for all OS)

## Creation of a new Virtual Environment

Virtual environment module is now bundled with Python 3.4. As it is fairly new, most users might not be familiar with using it. Hence, OS-specific installation instructions are given below.

If you OS or distribution is missing here, please skip to 'Others' section.

### Windows 7 or 8

Follow this [detailed guide](http://arunrocks.com/guide-to-install-python-or-pip-on-windows/). In summary:

1. If you don't have Python 3.4 then download the Python MSI installer from http://www.python.org/download/
2. Run the installer. Be sure to check the option to add Python to your PATH while installing.
3. Open PowerShell as admin by right clicking on the PowerShell icon and selecting ‘Run as Admin’
4. To solve permission issues, run the following command:

		Set-ExecutionPolicy Unrestricted

5. Enter the following commands in PowerShell to download the bootstrap scripts for easy_install and pip:

		mkdir c:\envs
		cd c:\envs

		(new-object System.Net.WebClient).DownloadFile('https://bootstrap.pypa.io/ez_setup.py',   'c:\envs\distribute_setup.py')

		(new-object System.Net.WebClient).DownloadFile('https://raw.github.com/pypa/pip/master/contrib/get-pip.py', 'c:\envs\get-pip.py')

		python c:\envs\distribute_setup.py
		python c:\envs\get-pip.py

	Now typing easy_install or pip should work

6. Check that you have the correct version of Python i.e. Python 3.4 and above:

		$ python --version
		Python 3.4.0

7. To create a Virtual Environment, use the following commands:

		python -m venv sbenv
		.\sbenv\Scripts\Activate.bat

### ArchLinux

Check that you have the correct version of Python i.e. Python 3.4 and above:

	$ python --version
	Python 3.4.0

Create a new virtual environment called `sbenv` and activate it:

	$ python -m venv sbenv
	$ source sbenv/bin/activate

### Ubuntu (14.10 and below)

Install Python 3.4:

	$ sudo apt-get update
	$ sudo apt-get install python3.4

Check that you have the correct version of Python i.e. Python 3.4 and above. Note that you need to mention `python3` command or Python 2 will be executed:

	$ python3 --version
	Python 3.4.2

Create a new virtual environment called `sbenv` (without pip) and activate it:

	$ python3 -m venv --without-pip sbenv
	$ source sbenv/bin/activate

Now you need to install pip. This command need `wget` to be installed first.

	$ wget bootstrap.pypa.io/get-pip.py -O - | python

## Installation of the project

Upgrade your version of pip:

	$ pip install -U pip

Make sure that `git` is installed before running the next command. Clone the example project from github and install the dependencies.

	$ git clone https://github.com/DjangoPatternsBook/superbook.git
	$ cd superbook
	$ pip install -r requirements.txt

If pip installation fails, especially if you are on Windows, then try forcing the installation of wheels:

	$ pip install --use-wheel -r requirements.txt 

Each chapter is a seperate git branch with the naming convention `chapternn`; for e.g. `chapter04`. Once you checkout the chapter don't forget to read the README.md file (which changes) and run the migrate command if applicable:

	$ git checkout chapter04
	$ python manage.py migrate

## Finished Site
	
If you would like to have a look at the finished SuperBook website, just run migrate and start the test server:

	$ git checkout final
	$ python manage.py migrate
	$ python manage.py createsuperuser
	$ python manage.py runserver

**DEMO SITE UNDER CONSTRUCTION**

[0]: https://www.python.org/
[1]: https://www.djangoproject.com/
Loading