Immediate Download Beginning Django: Web Application Development and Deployment With Python 1st Edition Daniel Rubio (Auth.) Ebooks 2024
Immediate Download Beginning Django: Web Application Development and Deployment With Python 1st Edition Daniel Rubio (Auth.) Ebooks 2024
com
https://textbookfull.com/product/beginning-django-
web-application-development-and-deployment-with-
python-1st-edition-daniel-rubio-auth/
https://textbookfull.com/product/tango-with-django-a-beginners-guide-
to-web-development-with-python-django-1-9-1st-edition-leif-azzopardi/
textbookfull.com
https://textbookfull.com/product/foundation-dynamic-web-pages-with-
python-create-dynamic-web-pages-with-django-and-flask-david-ashley/
textbookfull.com
https://textbookfull.com/product/django-for-beginners-build-websites-
with-python-and-django-william-s-vincent/
textbookfull.com
https://textbookfull.com/product/the-winnowing-fan-verse-essays-in-
creative-criticism-norris/
textbookfull.com
https://textbookfull.com/product/agriculture-and-korean-economic-
history-concise-farming-talk-nongsa-chiksol-seong-ho-jun/
textbookfull.com
https://textbookfull.com/product/learning-and-teaching-around-the-
world-1st-edition-kimberly-safford-liz-chamberlain/
textbookfull.com
https://textbookfull.com/product/designing-user-interfaces-michal-
malewicz-diana-malewicz/
textbookfull.com
Modeling Behavior in Complex Public Health Systems
Simulation and Games for Action and Evaluation 1st Edition
Christopher Keane Mph Scd
https://textbookfull.com/product/modeling-behavior-in-complex-public-
health-systems-simulation-and-games-for-action-and-evaluation-1st-
edition-christopher-keane-mph-scd/
textbookfull.com
Beginning
Django
Web Application Development and
Deployment with Python
—
Covers 1.11 LTS, compatible with
Python 2 and 3
—
Daniel Rubio
Beginning Django
Web Application Development and
Deployment with Python
Daniel Rubio
Beginning Django: Web Application Development and Deployment with Python
Daniel Rubio
F. Bahia, Ensenada, Baja California, Mexico
ISBN-13 (pbk): 978-1-4842-2786-2 ISBN-13 (electronic): 978-1-4842-2787-9
https://doi.org/10.1007/978-1-4842-2787-9
Library of Congress Control Number: 2017958633
Copyright © 2017 by Daniel Rubio
This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the
material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation,
broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage
and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or
hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with
every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an
editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are
not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to
proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of publication,
neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or
omissions that may be made. The publisher makes no warranty, express or implied, with respect to the material
contained herein.
Cover image by Freepik (www.freepik.com).
Managing Director: Welmoed Spahr
Editorial Director: Todd Green
Acquisitions Editor: Steve Anglin
Development Editor: Matthew Moodie
Technical Reviewer: Tri Phan
Coordinating Editor: Mark Powers
Copy Editor: Karen Jameson
Distributed to the book trade worldwide by Springer Science+Business Media New York,
233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail
orders-ny@springer-sbm.com, or visit www.springeronline.com. Apress Media, LLC is a California LLC
and the sole member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc).
SSBM Finance Inc is a Delaware corporation.
For information on translations, please e-mail rights@apress.com, or visit http://www.apress.com/
rights-permissions.
Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook versions
and licenses are also available for most titles. For more information, reference our Print and eBook Bulk
Sales web page at http://www.apress.com/bulk-sales.
Any source code or other supplementary material referenced by the author in this book is available to
readers on GitHub via the book’s product page, located at www.apress.com/9781484227862. For more
detailed information, please visit http://www.apress.com/source-code.
Printed on acid-free paper
To Valentina, Nancy and all my immediate family
To my uncle Alfonso, whose Commodore 64 let me gain an affinity
for technology
Contents at a Glance
■
■Chapter 1: Introduction to the Django Framework������������������������������������������������ 1
■
■Chapter 2: Django Urls and Views����������������������������������������������������������������������� 31
■
■Chapter 3: Django Templates������������������������������������������������������������������������������� 73
■
■Chapter 4: Jinja Templates in Django���������������������������������������������������������������� 117
■
■Chapter 5: Django Application Management����������������������������������������������������� 163
■
■Chapter 6: Django Forms����������������������������������������������������������������������������������� 217
■
■Chapter 7: Django Models��������������������������������������������������������������������������������� 275
■
■Chapter 8: Django Model Queries and Managers���������������������������������������������� 341
■
■Chapter 9: Django Model Forms and Class Views��������������������������������������������� 403
■
■Chapter 10: Django User Management�������������������������������������������������������������� 441
■
■Chapter 11: Django admin Management����������������������������������������������������������� 495
■
■Chapter 12: REST Services with Django������������������������������������������������������������ 549
■
■Appendix A: Python Basics�������������������������������������������������������������������������������� 567
Index��������������������������������������������������������������������������������������������������������������������� 585
v
Contents
■
■Chapter 1: Introduction to the Django Framework������������������������������������������������ 1
Django Framework Design Principles������������������������������������������������������������������������������ 2
Don’t Repeat Yourself (DRY) Principle����������������������������������������������������������������������������������������������������� 2
Explicit Is Better Than Implicit���������������������������������������������������������������������������������������������������������������� 4
Loosely Coupled Architecture����������������������������������������������������������������������������������������������������������������� 5
Install Django������������������������������������������������������������������������������������������������������������������� 5
Install Python (Prerequisite)�������������������������������������������������������������������������������������������������������������������� 6
Update or Install pip Package Manager (Prerequisite)��������������������������������������������������������������������������� 7
Install virtualenv (Optional Prerequisite)������������������������������������������������������������������������������������������������� 8
Install Django���������������������������������������������������������������������������������������������������������������������������������������� 11
Install Django from Git�������������������������������������������������������������������������������������������������������������������������� 11
vii
■ Contents
■
■Chapter 2: Django Urls and Views����������������������������������������������������������������������� 31
Url Regular Expressions������������������������������������������������������������������������������������������������� 31
Precedence Rule: Granular Urls First, Broad Urls Last�������������������������������������������������������������������������� 31
Exact Url Patterns: Forgoing Broad Matching��������������������������������������������������������������������������������������� 32
Common Url Patterns��������������������������������������������������������������������������������������������������������������������������� 33
Class-Based Views��������������������������������������������������������������������������������������������������������� 68
Built-In Class-Based Views������������������������������������������������������������������������������������������������������������������� 69
Class-Based View Structure and Execution������������������������������������������������������������������������������������������ 69
viii
■ Contents
■
■Chapter 3: Django Templates������������������������������������������������������������������������������� 73
Django Template Syntax������������������������������������������������������������������������������������������������� 73
Auto-Escaping: HTML and Erring on the Safe Side������������������������������������������������������������������������������� 74
ix
■ Contents
■
■Chapter 4: Jinja Templates in Django���������������������������������������������������������������� 117
Jinja Advantages and Disadvantages��������������������������������������������������������������������������� 117
Transition to Jinja Templates from Django Templates�������������������������������������������������� 118
What Works the Same Way in Jinja and Django Templates���������������������������������������������������������������� 118
What Works Differently in Jinja Templates Compared to Django Templates�������������������������������������� 119
New Concepts and Features in Jinja Templates vs. Django Templates���������������������������������������������� 121
x
■ Contents
xi
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
■ Contents
■
■Chapter 6: Django Forms����������������������������������������������������������������������������������� 217
Django Form Structure and Workflow�������������������������������������������������������������������������� 217
Functional Web Form Syntax for Django Forms��������������������������������������������������������������������������������� 219
Django View Method to Process Form (POST Handling)��������������������������������������������������������������������� 220
CSRF: What Is It and How Does It Work with Django?������������������������������������������������������������������������ 222
xii
■ Contents
xiii
■ Contents
■
■Chapter 7: Django Models��������������������������������������������������������������������������������� 275
Django Models and the Migrations Workflow��������������������������������������������������������������� 275
Create Django Models������������������������������������������������������������������������������������������������������������������������ 276
Migrations and the Django Model Workflow��������������������������������������������������������������������������������������� 277
xiv
■ Contents
■
■Chapter 8: Django Model Queries and Managers���������������������������������������������� 341
CRUD Single Records in Django Models����������������������������������������������������������������������� 341
Create a Single Record with save() or create()����������������������������������������������������������������������������������� 341
Read a Single Record with get() or get_or_create()��������������������������������������������������������������������������� 343
Update a Single Record with save(), update(), update_or_create(), or refresh_from_db()����������������� 345
Delete a Single Record with delete()�������������������������������������������������������������������������������������������������� 347
xv
■ Contents
xvi
■ Contents
■
■Chapter 9: Django Model Forms and Class Views��������������������������������������������� 403
Django Model Form Structure and Workflow��������������������������������������������������������������� 403
Create Django Model Forms����������������������������������������������������������������������������������������� 404
Django Model Form Options and Field Mapping���������������������������������������������������������� 405
Model Form Required Options: Model and Fields or Exclude������������������������������������������������������������� 405
Model Form Default Field Mapping���������������������������������������������������������������������������������������������������� 406
Model Form New and Custom Fields: Widgets, Labels, help_texts, error_messages,
field_classes, and localize_fields������������������������������������������������������������������������������������������������������� 408
xvii
■ Contents
■
■Chapter 10: Django User Management�������������������������������������������������������������� 441
Introduction to the Django User System����������������������������������������������������������������������� 441
User Types, Subtypes, Groups, and Permissions�������������������������������������������������������������������������������� 441
Create Users��������������������������������������������������������������������������������������������������������������������������������������� 442
Manage Users������������������������������������������������������������������������������������������������������������������������������������� 445
Create and Manage Groups���������������������������������������������������������������������������������������������������������������� 450
xviii
■ Contents
■
■Chapter 11: Django admin Management����������������������������������������������������������� 495
Set Up Django Models in the Django admin����������������������������������������������������������������� 495
Django admin Read Record Options����������������������������������������������������������������������������� 496
Record Display: list_display, format_html, empty_value_display������������������������������������������������������ 498
Record Order: admin_order_field and ordering���������������������������������������������������������������������������������� 502
Record Links and Inline Edit: list_display_links and list_editable������������������������������������������������������ 503
Record Pagination: list_per_page, list_max_show_all, paginator������������������������������������������������������ 506
Record Search: search_fields, list_filter, show_full_result_count, preserve_filters�������������������������� 507
Record Dates: date_hierarchy������������������������������������������������������������������������������������������������������������ 512
Record Actions: actions_on_top, actions_on_bottom, actions����������������������������������������������������������� 514
Record Relationships�������������������������������������������������������������������������������������������������������������������������� 514
xix
■ Contents
■
■Chapter 12: REST Services with Django������������������������������������������������������������ 549
REST Services in Django���������������������������������������������������������������������������������������������� 549
Standard View Method Designed as REST Service����������������������������������������������������������������������������� 550
Django REST Framework�������������������������������������������������������������������������������������������������������������������� 554
Django Tastypie Framework��������������������������������������������������������������������������������������������������������������� 554
■
■Appendix A: Python Basics�������������������������������������������������������������������������������� 567
Strings, Unicode, and Other Annoying Text Behaviors�������������������������������������������������� 567
Methods Arguments: Default, optional, *args, and **kwargs��������������������������������������� 571
Classes and Subclasses����������������������������������������������������������������������������������������������� 574
Loops, Iterators, and Generators���������������������������������������������������������������������������������� 576
List Comprehensions, Generator Expressions, Maps, and Filters��������������������������������� 581
Lambda Keyword for Anonymous Methods������������������������������������������������������������������ 583
Index��������������������������������������������������������������������������������������������������������������������� 585
xx
About the Author
Daniel Rubio has worked in software development for over 15 years, in roles that include developer,
software architect, manager, consultant, and CTO. He has worked with startups, government agencies, as
well as corporations in industries that include banking, education, social media, and retail.
He has coauthored the best-selling Spring Recipes book and other titles for Apress (2010), in addition to
writing for various other online publications. Daniel’s expertise in the early part of his career was focused on
Java, Linux, and open source technology, whereas more recently he has focused on Python, JavaScript, and
Cloud technology.
xxi
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
About the Technical Reviewer
Tri Phan is the founder of Programming Learning Channel on YouTube. He has over 7 years of experience
in the software industry. Specifically, he has worked in many outsourcing companies and has written many
applications of many fields in different programming languages such as PHP, Java, and C #. In addition, he
has over 6 years of experience in teaching at international and technological centers such as Aptech, NIIT,
and Kent College.
xxiii
Acknowledgments
I want to thank the entire team at Apress for making this book a reality. In particular, Steve Anglin to whom I
first presented this book as an idea; Mark Powers who was there every step of the way coordinating the work;
as well as Matthew Moodie and Tri Phan, both of whom helped me maintain the technical accuracy of the
book.
I would also like to thank all the customers and colleagues with whom I’ve had the pleasure to work
with throughout the years. Without all their questions and problems they faced, I would have never
discovered many of the solutions and techniques described in this book.
Finally, I would like to thank the entire community behind the Django framework for putting together
one the best web application frameworks on the market. Without their endless amount of work, the Django
framework and this book would not have come to light.
xxv
Introduction
The web framework market is an extremely competitive environment, with many programming languages
and framework design philosophies to choose from. But if you need to build web-based software with quick
turnaround times and a scripting language, there’s a high probability the Django framework – or something
built with it – will be your top choice.
Django has competitors, but even its nearest competitor in the Python ecosystem, the Flask framework
has about one-fourth the mind share of Django, based on the benchmark of worldwide Google searches
made for Django vs. Flask.1 Outside the Python ecosystem, but still in the scripting language segment, the
Ruby on Rails framework – which emerged along the same time as Django and follows a similar design
philosophy – has always maintained an almost equal mind share with Django, as it can also be proven by the
amount of worldwide Google search activity.
So what makes the Django framework such a strong choice for web development? It provides a rapid
development foundation to create complex web applications. A rapidness that is provided by a modular
and simple philosophy of not repeating constructs and logic throughout a project’s structure (a.k.a. the DRY
principle or Don’t Repeat Yourself principle).
And it’s this DRY principle, which has given way to a thriving community, as well as a multitude of
packages and other frameworks based on the Django framework. Over 10 years after its initial release, there’s
now a full-fledged CMS (Content Management System), a turn-key e-commerce platform and over 3000
packages, all built or designed to work with the Django framework. Not to mention, there are two annual
conferences in the United States and Europe to showcase Django innovations.
This book will walk you through the many core concepts associated with the Django framework. It will
help you learn standard and best practices that are essential to creating effective Django projects. And if and
when you use a Django-based package or framework, these same foundations will help you navigate the
more complex concepts and avoid any blind spots that are part of the core Django framework.
1
https://g.co/trends/yXpSy
xxvii
CHAPTER 1
The Django framework started in 2003, as a project done by Adrian Holovaty and Simon Willison at the
Journal-World newspaper in Lawrence, Kansas, in the United States. In 2005, Holovaty and Willison released
the first public version of the framework, naming it after the Belgian-French guitarist Django Reinhardt.
Fast forward to 2017 – the Django framework now operates under the guidance of the Django Software
Foundation (DSF), the framework core has over 1000 contributors with more than 15 release versions, and
there are over 3000 packages specifically designed to work with the Django framework.1
The Django framework has remained true to its origins as a Model-View-Controller (MVC)
server-side framework designed to operate with relational databases. Nevertheless, Django has stayed
up to date with most web development tendencies – via third-party packages – to operate alongside
technologies like non-relational databases (NoSQL), real-time Internet communication, and modern
JavaScript practices. All this to the point, the Django framework is now the web development framework
of choice for a wide array of organizations, including the photo sharing sites Instagram2 and Pinterest3;
the Public Broadcasting System(PBS)4; in the United States, National Geographic5; and with the help of
this book, your organization!
In this chapter you’ll learn about the Django framework design principles, which are key to
understanding the day-to-day aspects of working with the Django framework. Next, you’ll learn how to
install Django in various ways: as a tar.gz file, with pip, using git, and with virtualenv.
Once you install the Django framework, you’ll learn how to start a Django project and how to set it up
with a relational database. Next, you’ll learn about the core building blocks in the Django framework – urls,
templates, and apps – and how they work with one another to set up content. Finally, you’ll learn how to
set up the Django admin site, which is a web-based interface designed to access the relational database
connected to a Django project.
1
https://djangopackages.org/
2
https://engineering.instagram.com/what-powers-instagram-hundreds-of-instances-dozens-of-
technologies-adf2e22da2ad#.pui97g5jk
3
https://www.quora.com/Pinterest/What-is-the-technology-stack-behind-Pinterest-1
4
http://open.pbs.org/
5
https://github.com/natgeo
Notice how the Django models in Figure 1-1 each have different field names and a data type to restrict
values. For example, the statement name = models.CharField(max_length=30) tells Django a store name
should have a maximum of 30 characters, while the statement email = models.EmailField() tells Django
the contact entity should contain a valid email value. If the coffeehouse is like most web applications, you’ll
generally end up doing the following for the store and contact entities:
• Create relational database tables to save entity information.
• Create business logic to ensure the entities comply with requirements.
• Create HTML forms to allow data to be submitted for the entities.
2
Random documents with unrelated
content Scribd suggests to you:
regular meals. This place where the fish dam is put in is called by
them Cap-pell and is a bar of some twenty or thirty acres, high
enough so the river never over-flows it and yet it is very level. It is a
pretty place, being situated on the south bank of the Klamath river.
There are two villages on this pretty spot, one being Cap-pell which
was very large in the ages gone by and which contained a very large
number of Indians. The other village was called Sy-ah and was very
ancient, being the place where the lodge was situated. The house
they stay in is called Lah-wa-alth and the house where Lock and
Lock-nee sleep is called Ur-girk.
I will say to the white race that my people, or any other Indian
tribes as far as I know them, do not use the name of our Creator
when using profane language, as we would feel it a disgrace to do
so, even to think of such a thing. We never use the sacred name of
God, only in our prayers.
The following are a few expressions sometimes used: Kee-mol-len-
a Ta-ga-ar-a-wah-ma, (bad talk) pointing the right hand, with the
fingers extended, toward a person and at the same time saying:
Woo-saw-ah, means that the person is badly born, and they never
forgive you for this. Another is: Char-reck-quick-cal-lah, and means:
“I wish you were in hell”, and for this also they never forgive.
CHAPTER II.
ON His mighty Throne, high in the infinite realms of Heaven, sat the
great ruler of the stars and endless skies, Wah-pec-wah-mow (God).
As he peered down through the darkness of a cheerless and lonely
space, He created a new world, the earth on which we live. He first
made the soil of the earth and placed it in a buck-skin sack. He
opened the sack and shook the soil from it; it fell down into the
chasm of darkness, and Wah-pec-wah-mow could not see anything
but the intense darkness. He commanded that the rays of light
should penetrate the awful darkness, and there should alternately be
night and day. The sun to shine by day and the moon to shine by
night, to break the awful stillness of this once dark and cheerless
world.
Gazing down from His Throne on high, Wah-pec-wah-mow saw
the world he had created was a desolate waste without human life,
or life of any kind. He now began the transformation of the new
world, and lo, the once barren surface of the earth was clothed in
verdure; forests lifted their giant branches sky-ward; tranquil
streams flowed and great rivers wended their way to the ocean.
The first living thing placed upon the earth was the white deer
(Moon-chay-poke). The white deer roamed over the hills, mountains,
in the valleys and on the plains. He was the pride and dignity of the
animal kingdom. This is why the Klamath Indians revere the white
deer that is so sacred to their hearts and use the skin as an emblem
of purity, in one of their greatest festivals, or worships, which is
termed in English as, “The White Deer-skin Dance.” In the Indian
language it is called, “Oh-pure-ah-wah”; which does not mean dance
but means one of their most sacred religious festivals.
The next living creature that Wah-pec-wah-mow placed upon the
earth was the red eagle, Hay-wan-alth, who has ever since ruled as
the monarch of the skies. The Indians prize the feathers of this
eagle very highly, and use them in their great festival. In the
decoration of their head-gear, they take a single feather, fasten it in
the hair at the back of the head, arranging it so that it stands
straight up. They also use the feathers of the bald eagle, Per-gone-
gish, and the gray eagle, Per-gish, sometimes as a substitute for the
feathers of the red eagle.
After the white deer and red eagle was placed upon the earth,
Wah-pec-wah-mow now created all the other animals of the earth.
Some were to roam upon the plains, others in the forests, some to
eat grass and others to devour other animals, etc.
Wah-pec-wah-mow did not give our people any single day during
the week or month, as a day of worship, but gave them a certain
season of the year in which to hold their religious ceremonies. This
season of worshipful ceremonies usually begins in the month of
September, and lasts for several days. It is the season of the year
when the water of the rivers and brooks ebb lowest, and the
summer is almost ready to wane into the glories of Autumn. This
season is called, “Kne-wal-la-taw,” the eighth month of the year,
according to our way of reckoning time.
When Wah-pec-wah-mow had finished creating the plant and
animal life of the earth, He then created the first real man. He made
the first man of the soil of the earth, and placed him in the beautiful
valley of Cheek-cheek-alth. This valley was located in a far off
northern clime. When the first man was created and he became a
living being upon the earth, Wah-pec-wah-mow said to him, “You
are a living man.” God named this man He-quan-neck. Inspired with
the breath of life, He-quan-neck first saw the light of day in this
sweet valley of sunshine, flowers, fruits and herbs. Among the
growing herbs was the herb walth-pay, which has a forked root. God
saw that the man was lonely in this sunny valley, and he was not
pleased with his work. Wah-pec-wah-mow now requested He-quan-
neck to blow his nose, which he did, and immediately the forked
root, or walth-pay turned into a living woman, Kay-y-yourn-nak. Man
now became blessed with a living companion and for a time they
dwelt together in the chaste life of peace and happiness.
Our tradition has been handed down through the long centuries,
the first dwelling place of man and woman was far away in a
northern clime. It would seem a distant land across the waters from
the North American continent that is located in the northern part of
the world, which we call Cheek-cheek-alth.
Man and woman in the valley of Cheek-cheek-alth knew no sin,
two pure souls were they in this valley of perpetual sunshine and
flowers.
The loneliness of two human beings dawned upon Wah-pec-wah-
mow so he decided to have the earth populated with people. He
now caused He-quan-neck and Kay-y-yourn-nah to fall asleep, and
while they slept He caused the snake to crawl across the woman’s
bare abdomen, that awakened the sleepers, and this opened their
eyes to their nudeness and thereafter they knew sin. The finer
senses of the woman awoke, as she became deeply humiliated at
the sight of her naked self, and she began to fasten leaves together
from the herb, Cur-poo-sa-gon, out of which she made an apron to
clothe herself. Thus the first garment that woman wore was from the
leaves of this wonderful plant. This plant grows in abundance along
the lower Klamath river and its surrounding regions, and the little
Indian girls up to this day like to gather these leaves, rub their face
and hands with and wear them upon their heads under their caps.
These leaves have a very strong and unpleasant odor.
Wah-pec-wah-mow commanded the man and woman to go forth
and bring children upon the earth. A curse fell upon the woman, that
she should bear children with pain, therefore every woman after her,
through all the long centuries has had to endure this hardship. The
first children were born some with light hair and fair skin and blue
eyes, and some with black hair, dark skin and black eyes and as they
married they would mate with black hair, the others with light hair
and when they left the old land Cheek-cheek-alth they were not so
dark, many of them were light haired, fair and blue eyed.
Wah-pec-wah-mow put a curse upon the snake that it should
crawl upon its belly as long as the earth should last.
God’s laws were that every man and woman should marry and
bring forth children. These people were taught to obey the laws and
be honest. They increased in number until they became very
numerous, and at that time, they all talked the same language. As
time sped by they became very numerous and Wah-pec-wah-mow
now caused our people, the Indians, to start on their long journey,
away from their native haunts and childhood’s land, Cheek-cheek-
alth. We do not know how long, but they wandered thus in search of
a new land, leaving behind them only a memory of the old land. A
land that claims its own no more in life and like a people in exile
they wandered on.
CHAPTER III.
WHEN the Indians first made their appearance on the Klamath river
it was already inhabited by a white race of people known among us
as the Wa-gas. These white people were found to inhabit the whole
continent, and were a highly moral and civilized race. They heartily
welcomed the Indians to their country and taught us all of their arts
and sciences. The Indians recognized the rights of these ancient
people as the first possessors of the soil and no difficulties ever
arose between the two people. Their hospitality was exceedingly
generous in the welfare of our people and all prospered together in
peace and happiness, in their pursuit of human existence. After a
time there were inter-marriages between the two races, but these
were never promiscuous. For a vast period of time the two races
dwelt together in peace and honored homes, wars and quarrels were
unknown in this golden age of happiness. No depredations were
ever committed upon the property of their people, as the white
people ruled with beacon light of kindness, and our people still
worship the hallowed places where once they trod. Their morals
were far superior to the white people of today, their ideals were high
and inspired our people with greatness. After we had lived with
these ancient people so long, they suddenly called their hosts
together and mysteriously disappeared for a distant land, we know
not where. We have no memory of their reason or cause why they
abandoned their ancient homes where they had dwelt for untold
centuries. Wars did not drive them forth, for we loved them more
than brothers, and difficulties were unknown between the two
people. On leaving they went toward the North from whence we
came, and disappeared from our land beyond the northern seas. It
was a sad farewell when they departed from this land, for our
people mourned their loss, as no more have we found such friends
as they, so true and loyal. In their farewell journey across this land
they left land-marks of stone monuments, on the tops of high
mountains and places commanding a view of the surrounding
country. These land-marks we have kept in repair, down through the
ages in loving remembrance. I have seen many of these land-marks
myself (and often repaired them) that they left as a symbol of the
mystic ages and the grandeur of a mighty nation that passed in a
single season. Oh, how little we know of the depths of the ages
gone, how wide, how profound and deep is the knowledge we seek;
a monument of stone, a stone bowl, a broken symbol, a hallowed
unknown spot, a lodge of ruins, all this makes a golden page
glittering with diamonds that trills the emotions with mysterious
longings for truth and light in the depths unknown.
When the Wag-as left this land they assured my people that they
would return to them at some future time. Perchance thousands of
years have elapsed since then, and they have not returned, we have
waited in vain for it seems that our cherished hopes are fading.
However, some of our people are still looking for the return of the
white man. The traditions handed down lead us to believe that the
Wa-gas returned to the land of their birth, in the far north, the valley
of Cheek-cheek-alth, as their traditions were given to us that their
origin was in this same land of Cheek-cheek-alth, as they came down
from the North when they came to this land. When the Wa-gas first
arrived on this continent they handed down the traditions to us that
it was inhabited by a giant race of people when they first came.
These giants were represented by the Wa-gas as being very swarthy
in complexion, and they used implements so large that no ordinary
man could lift them. It was an age when large animals roamed the
earth, and it seems the birds and fowls were all very large in size. It
appeared to be the first age, and was the age of the giants. The
recollections transmitted by the Wa-gas were that these giants were
very cruel and wicked. It was said that God became displeased with
them and destroyed them and they all perished from the earth. It
was also said that God appeared to the High Priest of the Wa-gas
and told them that he was going to destroy the giant race and that
the Wa-gas themselves would survive upon the earth as a new
people. Smaller birds and animals would appear upon the earth for
the use of man, thus the age of giants perished, but the Wa-gas do
not hand down any tradition of how they perished from the earth, as
my people have no recollections of ever seeing giants. My mother
says that our people in ancient times have seen many relics
belonging to these prehistoric giants, such as huge stone bowls,
stone slabs and other implements so great that our people could not
move them. During the ages of rains and wearing away of the earth,
these implements have been buried so deep and have sunk into the
earth, that is the reason we cannot find them today. The Indian
name for the giant race is Pah-pel-ene, which means people that
have all died and passed away.
When the Wa-gas returned to Cheek-cheek-alth it is supposed
they found a ladder in this beautiful valley which extends from earth
to Heaven, and climbed it to Werse-on-now, (Heaven) where they
dwell with God. All the half castes with the exception of a few went
away with the Wa-gas, and nearly all those that were three quarters
Indian remained with our people. This is said to be the reason why
some of our people are very fair. Some of the Indians are still
looking for their return to the earth, when they come back it is
believed that peace and happiness will reign supreme again over this
great land and all evil will be cast out. When the present race of the
white people made their first appearance upon the American
continent, we believed it was the Wa-gas returning and a hearty
welcome was extended to them and there was great rejoicing
among our tribes. But soon the sad mistake was discovered to our
sorrow, when the men began to debauch our women, give whiskey
to our men and claim our land that our forefathers had inhabited for
so many thousands of years, yet not a single family has ever been
driven from their house on the Klamath river up to this day. We no
longer termed them as Wa-gas, but as Ken-e-yahs, which means
foreigners, who had no right to the land and could never appreciate
our kindness, for they were a very different people from the Wa-gas.
They had corrupt morals that brought dissolution upon our people
and wrought the horrors of untold havoc.
When the Indians first reached the Klamath river there were large
prairies and vast tracts of grassy land, which have since grown up in
timber and under-brush. Many of the prairies were set on fire and
burnt off every year during the dry seasons which kept the timber
from growing up very fast.
The Klamath emptied into the ocean at Wilson creek, about six
miles north of where it now goes into and ocean at Reck-woy. There
were high bluffs of rocks between the river and the ocean all the
way from Reck-woy to Wilson creek, which kept the river in its
course to Ah-man (Wilson creek) where it emptied into the ocean.
The river was said to have kept in this course until our Christ caused
the mighty rocks to split open and the waters of the river rushed
ahead to the ocean at Reck-woy, where it has ever since flowed into
the ocean.
The traditions handed down say that the land, north of Redwood
creek, where it goes into the ocean, extended far out into the sea to
the large rock that is now known to the white people as Redding
rock, has continually washed away leaving this rock jutting up from
the ocean depths and can be seen for many miles over the
surrounding area of land and sea. This rock is located at a distance
of about ten miles from the shore and is called by the Indians Sa-
quan-ow. This name translated into English means an acorn pestle,
a conical shaped stone, carved out of granite and is used to pound
acorns and grass seeds into the finest flour. Long ages ago Redding
rock extended up from the ocean to a great height, and from a
distance appeared to be a huge Sa-quan, or pestle, hence its name.
After ages of erosion the massive rock became surrounded by water
and the receding bluffs left it alone out in the ocean where its
greater portion has crumbled and fallen beneath the waves as it is
seen today. The Indians still call it Sa-quan-ow.
There has been but little change in the channel of the Klamath
river, except at its mouth since our arrival in this land. In olden times
the channel of the river was very deep and clear and much narrower
than it is now and large bars of alluvial soil composed its banks,
where luxuriant grasses grew, and upon these lowlands during the
winter months great herds of deer and elk would graze, coming
down from the snow covered mountains. The channels of the large
creeks and tributaries of the river, such as Blue creek, (Ur-ner) Tec-
tah and Pec-wan have practically never changed as they still flow
into the river in the same places. Where the Trinity river flows into
the Klamath river it has made but little or no change during the
passing ages as has been handed down to us.
We have no word of severe earthquakes in our regions, but have
had slight shocks from time to time throughout the centuries. We
have no tales of any great damage ever done by earthquakes and
our people never held any fear of tremors of the earth. But my
people tell of great tidal waves that have swept our country. They
say a long time ago one swept up the Klamath river to the mouth of
the Trinity river, a distance of over forty miles, and did great
damage, as it swept away houses and thousands of our people were
drowned and carried away by the rolling waves of the ocean, so few
of our tribe were left that they were well nigh exterminated. Many
smaller tidal waves have swept over the coast where the destruction
was not so great.
They tell of epidemics that came up the river and laid us low in
the devastation of life, thousands of our people would pass away in
a single season; they would die so fast that they could not be buried
and many of the bodies would be thrown into the river. The only way
we could keep the whole tribe from complete devastation by the
ravages of these dreadful diseases was to abandon the dead and
leave the river and go back into the high mountains and there we
built bark houses and remain until the snow and cold would compel
us to retreat to the lowlands again. In our mountain home we
subsisted on wild game, berries, pine nuts, roots and herbs. Some of
our people would have such a terror of the fatal diseases that they
would refuse to return to their homes and would brave the fierce
storms of the cold winter until they were convinced that all dangers
had ceased. In our traditions of the passing centuries many of these
epidemics have almost devastated the land of human life. During
one of these contagions it was said that the children would go down
to the river to swim and would lie down in rows from six to twelve in
number upon the sand, as if they were alive and had been placed
there by careful hands; but they would be in their eternal sleep,
contagion having overtaken them.
CHAPTER V.
WE have ten months for one year, and four seasons, as follows:—
1st month: Caw-cha-witch.
2nd month: Nan-ah-wetch.
3rd month: Nachk-sa-witch.
4th month: Chaw-na-ah-wertch.
5th month: Mere-i-yaw.
6th month: Cauh-chow.
7th month: Chere-wer-sere.
8th month: Cana-wal-a-ture.
9th month: Cher-mick.
10th month: Wealth-ah-wah.
Spring: Key-atch-ker.
Summer: Kis-sa-no.
Autumn: Ka-yock-ka-muck.
Winter: Cah-mah.
We lose time in our count each year, so we throw in or stop
counting until the time comes around to start again. The Klamath
Indians are good in counting and can count up into the thousands.
We count ten, and ten hundreds for one thousand. All of our
counting is done by whole numbers; we have no fractions. All the
women have to count and count closely in weaving baskets in order
to make the designs come out correctly. We have astronomers,
called Haw-getch-neens, and they keep close observation of the sun,
which we call Ca-chine-wan-now-slay. Day we call Ca-chine; the
moon, Nas-cha-wan-now-sloy, this means the night sun.
English names. Klamath Indian.
An old woman Ca-par-a
Young women Way-yun
Little girl Wer-yes
English names. Klamath Indian.
Baby Oaks
Boat or canoe Yacht
House Och-lum-ilth
Come in the house Och-la-may
How do you do my friend I-ya-quay Nec-tor-mer
Me or I Neck
Yes A
Fire Metch
Mother Calk
Father Tat, or Tatus
Grandfather Peach
Grandmother Gooch
Old man Ma-we-mer
Young man Pay-girk
Large boy Che-na-mouse
Small boy May-wah
Mother-in-law Cha-win
Father-in-law Par-ah
Sister-in-law Netch-nah
Brother-in-law Weitch-tay, or Tay
Uncle Jim
Aunt Tool
Klamath river Health-kick-wer-roy
Redwood timber Keilth
Mermaids Squer-tuck
Silver Salmon Nep-puoy
Steelhead Salmon Squalth
King Salmon Ah-pus
Hook-bill Salmon Cha-goon
Grizzly Bear Nick-witch
Sea or Ocean Pis-calth
The Bald Hills we call Cho-lu, contains many hundreds of acres of
open land, high up where one can see as far as the eye can reach in
all directions.
There is another species of the Salmon caught in the Klamath
river, the English name of which I do not know but we call it Ra-
gawk.
In the year 1850 my people had never heard of the present white
race and we were then making our fires with two pieces of wood,
one the willow and the other of hardwood.
My mother and father never learned to talk English, so I talk to
them only in our own language.
CHAPTER VI.
THERE is a large and silent river that flows through the shadowy
vale of death. On the banks of this awful and mysterious river dwells
an old woman, called Sye-elth, and she keeps at her side a large
dog, Chish-yah, (the common name for dog).
When an Indian dies, if he has led a dishonorable and wicked life,
a broad path leads his soul down to the banks of the river to the
very door where the old woman lives in her house. When the
wandering soul reaches her door, the Chish-yah tries to drive it back
to the dead body, but the old woman fights the dog off and if she is
successful in her efforts she takes charge of the miserable soul and
sends it on to the opposite side of the river, in the shadowy land of
endless anguish. If the dog is successful in fighting the soul back it
returns to the dead body where life is regained and the person lives
again. This seldom occurs, and only where the body lives in a state
of coma and is supposed to be dead, but after a few hours comes
out of that state and revives into life again. The Chish-yah is seldom
successful, as a case rarely occurs. This is why the Indian never likes
to scold or treat the dog badly.
The old Indians do not like to look at a photograph or to have
their photographs taken, because they say it is a reflection or a
shadowy image of the departed spirit, O-quirlth. They do not like to
see spirits, but they say they have often seen them. This is the
reason they turn their backs on the camera and object so strongly to
having their pictures taken. Often have my people been ridiculed for
their strange actions, but they have a reason for every one of them.
If the civilized man could only respect the reasons and simple ways
of the highest type of primitive man, as much as primitive man
venerates his civilization.
When the spirit comes back to the tired and weary body, and that
body lives again, that person is said to meet a very unfortunate
existence. It is said he is never satisfied with earthly things again.
He is very restless and unhappy as nothing can satisfy his longing
soul, and always meets death suddenly.
On the shore of this mysterious River of Death awaits a young
man, Pa-ga-rick, in his canoe; he is always ready to receive the soul
from the old woman as she hands it into his care. His canoe is
similar in shape and size to the earthly Indian canoes, with the
exception that if one may note carefully that all the canoes contain
in the bow a knob in the center, some three feet back from the bow,
which is the heart, and they say it is the life of the boat. Also the
canoe the Indians use is burned inside and out, and polished
smooth. The canoe that Pa-ga-rick uses for the crossing of the souls
is neither burned or polished and has no heart, therefore it is called
the dead boat, merm-ma. In olden times no Indian would venture
out in a boat upon the water that did not contain a heart, as they
said it was lifeless and would be sure to sink or some disaster befall
it. We call our canoe here on earth, Yatch.
Sye-elth [TN: lives?] just on the bank of this dark River of Death,
Char-reck-quick-werroy, where she gets the souls away from the
dog. She takes it to the water’s edge and gives it to the man in the
dead boat. He takes the soul into his canoe, paddles it across those
silent waters, the awful stillness, the awful fear of death. When the
canoe, Merm-mo or Nee-girk, either name, touches the opposite
shore, Po-ga-rick, takes the soul, o-quirlth, and banishes it into exile,
exile without an end or example in story, and leaves it in a
wilderness. In this wilderness it is damp, a constant gloom is cast,
dark and fearful clouds forever flit, cold winds forever howl and
shriek the agonies of hell.
In this terrible wildness, the souls of the condemned men and
women sustain their misery up on bitter berries, bitter grasses and
roots, and cannot die. They had never lived but a wasted life upon
earth, therefore they can wait to die, as souls never die. These
wretched souls since Time began, and I think the time is sad and
heavy through all the weary ages, since they go wandering,
hallowing, moaning, weeping and wailing, grieving grief without an
end and suffering pain, intense pain that knows no ending. Thus,
Wah-pec-wah-mow, the Great God has seen fit to punish his
disreputable children until the judgment day.
Sye-elth, this old woman, is the satan of my people, Chish-yah,
the dog, is our Guardian Angel. This old woman is our evil doer who
is always trying to influence the Indians away from the path of
rectitude. She hovers about them in life unseen, seeking out their
weak points, that she may lead them evil ways and vindicate her
cruel wants upon their death by taking their souls down the broad
path to the wilderness of anguish. Fearing her powers, fearing the
Unhappy Land, the Indians struggle to live simple and peaceful lives
and never quarrel over their religion.
The wretched souls banished into the wilderness of anguish do not
quarrel with one another, as they are too wretched in their own
agony to concern themselves about others.
The Indian seeing a vision of the unhappy land tries to live the
simple and honest life, near to nature, and their nature’s God.
However, there is not a tribe however well guarded but some and
sometimes many stray afar from the path of rectitude and are lead
into the wilderness of anguish by their cruel Satan, Sye-elth.
My people believe that there will sometime come a chance for
them to become regenerated, or reborn, so that many of them will
be given the opportunity to recompensate for the wickedness of
their former lives and given a chance to live good clean lives in their
second birth. Thus given the opportunity by God when they die
again, they will be rewarded in going to Heaven, Werse-on-now.
However, if the ones given the opportunity of being saved, do not
live lives of integrity after their second birth, they are cast off and
destroyed forever.
The Indians who had always lived the life of integrity on earth
when they die their soul or spirit travels a narrow and winding trail
which takes the soul to north, to a land far away from their native
haunts. This far northern clime is said to be the old land of Cheek-
cheek-alth, where the spirit finds a ladder that reaches from earth
into Heaven. As the spirit climbs the ladder to Heaven it reaches God
on that infinite shore where it dwells forever in flowery fields of light,
straying together with the Master in peace and love, and joining the
spirits of those that have gone before them.
Can you of the Christian faith comprehend why we take so kindly
to your own belief? Yet we think that ours is the most perfect and
yet you call us savage. We love our God almost akin to sadness and
are always ready with a prayer-offering, be it midday hour or in the
hours of the silent night. The Indian in all his savagery, could never
blaspheme the sacred name of his Creator in man’s builded houses,
or in his daily life as he is a child of nature, akin to nature’s God,
that the Divine Being is the beacon light of his soul, showing him life
beyond the grave and into the flowery fields of light and love, on
that infinite shore, into the glories of Heaven.
The Indian through his long centuries of barbarism battled with
the environments of barbaric man. In his child-like nature he taught
his sons and daughters to be kind, courageous, self-denying,
industrious and above all have integrity that could not be
questioned. Fathers, brothers and cousins guarded the mothers,
daughters and sisters, that not one of them may stray into a life of
shame by the passions of designing men. Woman was manifestly the
upholder of her race, loved as the unassuming creature, who gave to
the race clean limbed and vigorous men. But ah, the sad knell, the
approach of civilized man, and his crushing hand of debauchery to
the sorrow of our race, and our laws have long since been
demolished, and with it our true religion, our life blood, our all. Out
of the gloom of saddened years, rising in scattered remnants, who
like the children of Israel that have lived without a country for many
weary centuries, we are struggling to gain our own once more.
Freedom to worship God in our own way and to be allowed to
become citizens of this our own glorious country.
When a illegitimate child was born, mother and child lived in
disgrace and after death could never reach the kingdom of Heaven,
but traveled that broad road which leads to the wilderness, being
forever lost. During their life the mother is always addressed as Caw-
haw, a name that reminds her always of her disgrace every time she
is spoken to, and the child is always reminded of its unwedded
mother. Sometimes the unfortunate mother may marry, but she is
always known as Caw-haw as long as she lives and can not take the
name of the man she marries.
Those who sought unscrupulous brawls were low and disgraced,
all traveled after death the broad road to Satan and are never given
an opportunity to go to Werse-on-now. There are many of the
miserable souls who lived a wasted life on earth, only to enter in the
Spirit Land, the wilderness of anguish.
In marriage the wife takes the husband’s name and the husband
takes the wife’s name, just as an exchange of names and the family
names are handed down from one generation to another. This is
done by giving the name to a daughter, son, cousin, etc., either the
mother or father’s name on both sides of the family. Sometimes the
generation dies out and there are none left of a near kindred, in this
case they sometimes give the name to a close friend and this
custom is followed more by the high families. As an example, some
years ago an old man lived in the Pec-wan village, his name was Ta-
poo-sen. He died some thirty years ago, and at this writing a middle
aged man is living in the Cor-tep village who adopted his name after
his death, and he is known to every one as Ta-poo-sen. There are
quite a number of Indians living at the present time who have taken
the names of deceased relatives or friends. The deceased has been
laid at rest for at least one year before any one takes his or her
name.
The Klamath Indians are very much prejudiced against one taking
their own life. They look down on the act, and if one should take his