-
Notifications
You must be signed in to change notification settings - Fork 136
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
0 parents
commit 46dda3e
Showing
132 changed files
with
8,006 additions
and
0 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,15 @@ | ||
# Set the default line ending behavior. | ||
* text eol=lf | ||
|
||
# Explicitly declare text files you want to always be normalized and converted | ||
# to native line endings on checkout. | ||
*.py text | ||
*.html text | ||
*.js text | ||
*.css text | ||
*.json text | ||
|
||
# Denote all files that are truly binary and should not be modified. | ||
*.png binary | ||
*.jpg binary | ||
*.gif binary |
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,15 @@ | ||
*.pyc | ||
*Thumbs.db | ||
*~ | ||
*.sqlite3 | ||
*.txz | ||
*.tgz | ||
media/ | ||
build/ | ||
dist/ | ||
__pycache__ | ||
codered_cms.egg-info/ | ||
coderedcms.egg-info/ | ||
.vscode/ | ||
testapp/ | ||
testproject/ |
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,160 @@ | ||
# Documentation | ||
|
||
[< Back to README](README.md) | ||
|
||
Table of Contents: | ||
* [Quick Start](#quick-start) | ||
* [Customizing your website](#customizing-your-website) | ||
* [Searching](#searching) | ||
* [Hooks](#hooks) | ||
* [Settings](#codered-cms-settings) | ||
* [Developing coderedcms](#developing-and-testing-codered-cms) | ||
|
||
|
||
|
||
|
||
## Quick start | ||
1. Run `pip install coderedcms` | ||
|
||
2. Run `coderedcms start mysite` | ||
|
||
3. Run `python manage.py migrate` to create the core models. | ||
|
||
4. Run `python manage.py createsuperuser` to create the initial admin user. | ||
|
||
5. Run `python manage.py runserver` to launch the development server, and go to `http://localhost:8000` in your browser, or `http://localhost:8000/admin/` to log in with your admin account. | ||
|
||
|
||
|
||
## Customizing your website | ||
After following the quickstart, you are greeted by a barebones website. There are a few settings you will want to change to add your own branding. | ||
|
||
### Site name | ||
This is shown by default in the navbar, and also added to the title attribute of each page. This can be changed in Settings > Sites > localhost. Hostname and port only need to be changed when running in production. | ||
|
||
### Site settings | ||
Under Settings > Sites in the Wagtail Admin, you will want to make sure this setting is up to date with the proper Hostname and Port. Failure to do so can cause the Preview button on pages to return a 500 error. | ||
|
||
### Logo & icon | ||
The logo that appears in the navbar, the wagtail admin, and your favicon can be set in Settings > Layout. Here you can also change navbar settings (based on Bootstrap CSS framework). | ||
|
||
### Navigation bars | ||
Navbars are top navigation elements that create a "main menu" experience. Navbars are managed as snippets. They render from top down based on the order they were created in. | ||
|
||
### Footers | ||
Similar to Navbars, footers are also managed as snippets and also render top down based on the order they were created in. | ||
|
||
### Custom CSS | ||
A django app called `website` has been created to hold your custom changes. In website/static/ there are custom.css and custom.js files that get loaded on every page by default. Adding anything to these files will automatically populate on the site and override any default styles. By default, Bootstrap 4 and jQuery are already included on the site. | ||
|
||
### Custom templates | ||
The templates directory inside the `website` app is empty by default. Any templates you put in here will override the default coderedcms templates if they follow the same name and diretory structure. This uses the standard Django template rendering engine. For example, to change the formatting of the article page, copy `coderedcms/templates/coderedcms/pages/article_page.html` to `website/templates/coderedcms/pages/article_page.html` and modify it. | ||
|
||
### Custom models | ||
The django app `website` has been created with default models based on pre-built abstract CodeRed CMS models. You can use these as-is, override existing fields and function, and add custom fields to these models. After making a change to any of these models, be sure to run `python manage.py makemigrations` and `python manage.py migrate` to apply the database changes. | ||
|
||
|
||
## Searching | ||
A search page is available by default at the `/search/` URL, which can be customized in the `urls.py` file in your project. To enable a search bar in the navigation bar, check Settings > Layout > Search box. Search results are paginated; to specify the number of results per page, edit the value in Settings > General > Search Settings. | ||
|
||
### Search result formatting | ||
Each search result is rendered using the template at `coderedcms/pages/search_result.html`. The template can be overriden per model with the `search_template` attribute. | ||
|
||
### Search result filtering | ||
To enable additional filtering by page type, add `search_filterable = True` to the page model. The `search_name` and `search_name_plural` fields are then used to display the labels for these filters (defaults to `verbose_name` and `verbose_name_plural` if not specified). For example, to enable search filtering by Blog or by Products in addition to All Results: | ||
``` | ||
class BlogPage(CoderedArticlePage): | ||
search_filterable = True | ||
search_name = 'Blog Post' | ||
search_name_plural = 'Blog' | ||
class Product(CoderedWebPage): | ||
search_filterable = True | ||
search_name = 'Product' | ||
search_name_plural = 'Products' | ||
``` | ||
Would enable the following filter options on the search page: All Results, Blog, Products. | ||
|
||
### Search fields | ||
If using the Wagtail DatabaseSearch backend (default), only page Title and Search Description fields are searched upon. This is due to a limitation in the DatabaseSearch backend; other backends such as PostgreSQL and Elasticsearch will search on additional specific fields such as body, article captions, etc. To enable more specific searching while still using the database backend, the specific models can be flagged for inclusion in search by setting `search_db_include = True` on the page model. Note that this must be set on every type of page model you wish to include in search. When setting this flag, search is performed independently on each page type, and the results are combined. So you may want to also specify `search_db_boost` (int) to control the order in which the pages are searched. Pages with a higher `search_db_boost` are searched first, and results are shown higher in the list. For example: | ||
``` | ||
class Article(CoderedArticlePage): | ||
search_db_include = True | ||
search_db_boost = 10 | ||
... | ||
class WebPage(CoderedWebPage): | ||
search_db_include = True | ||
search_db_boost = 9 | ||
... | ||
class FormPage(CoderedFormPage): | ||
... | ||
``` | ||
In this example, Article search results will be shown before WebPage results when using the DatabaseSearch backend. FormPage results will not be shown at all, due to the absence `search_db_include`. If no models have `search_db_include = True`, All CoderedPages will be searched by title and description. When using any search backend other than database, `search_db_*` variables are ignored. | ||
|
||
|
||
|
||
## Hooks | ||
Building on the concept of wagtail hooks, there are some additional hooks in CodeRed CMS | ||
|
||
### `is_request_cacheable` | ||
The callable passed into this hook should take a `request` argument, and return a `bool` indicating whether or not the response to this request should be cached (served from the cache if it is already cached). Not returning, or returning anything other than a bool will not affect the caching decision. For example: | ||
``` | ||
from wagtail.core import hooks | ||
@hooks.register('is_request_cacheable') | ||
def nocache_in_query(request): | ||
# if the querystring contains a "nocache" key, return False to forcibly not cache. | ||
# otherwise, do not return to let the CMS decide how to cache. | ||
if 'nocache' in request.GET: | ||
return False | ||
``` | ||
|
||
|
||
|
||
## CodeRed CMS Settings | ||
Default settings are loaded from coderedcms/settings.py. Available settings for CodeRed CMS: | ||
|
||
### CODERED_CACHE_PAGES | ||
Boolean on whether or not to load the page caching machinery and enable cache settings in the wagtail admin. | ||
|
||
### CODERED_CACHE_BACKEND | ||
The name of the django cache backend to use for CodeRed CMS. Defaults to `'default'` which is required by Django when using the cache. | ||
|
||
### CODERED_PROTECTED_MEDIA_ROOT | ||
The directory where files from File Upload fields on Form Pages are saved. These files are served through django using `PROTECTED_MEDIA_URL` and require login to access. Defaults to `protected/` in your project directory. | ||
|
||
### CODERED_PROTECTED_MEDIA_URL | ||
The url for protected media files from form file uploads. Defaults to '/protected/' | ||
|
||
### CODERED_PROTECTED_MEDIA_UPLOAD_WHITELIST | ||
The allowed filetypes for media upload in the form of a list of file type extensions. Default is blank. For example, to only allow documents and images: `['.pdf', '.doc', '.docx', '.txt', '.rtf', '.jpg', '.jpeg', '.png', '.gif']` | ||
|
||
### CODERED_PROTECTED_MEDIA_UPLOAD_BLACKLIST | ||
The disallowed filetypes for media upload in the form of a list of file type extensions. Defaults to `['.sh', '.exe', '.bat', '.app', '.jar', '.py', '.php']` | ||
|
||
### CODERED_FRONTEND_\* | ||
Various frontend settings to specify defaults and choices used in the wagtail admin related to rendering blocks, pages, and templates. By default, all CODERED_FRONTEND_\* settings are designed to work with Bootstrap 4 CSS framework, but these can be customized if using a different CSS framework or theme variant. | ||
|
||
|
||
|
||
## Developing and testing codered-cms | ||
To create a test project locally before committing your changes: | ||
|
||
1. Run `pip install -e ./` from the codered-cms directory. The -e flag makes the install editable, which is relevant when running makemigrations in test project to actually generate the migration files in the codered-cms pip package. | ||
|
||
2. Follow steps 3 through 5 in the quickstart above. Use "testproject" or "testapp" for your project name to ensure it is ignored by git. | ||
|
||
3. When making model or block changes whithin coderedcms, run `makemigrations coderedcms` in the test project to generate the relevant migration files for the pip package. ALWAYS follow steps 3 and 4 in the quickstart above with a fresh database before making migrations. | ||
|
||
4. When model or block changes affect the local test project (i.e. the "website" app), run `makemigrations website` in the test project to generate the relevant migration files locally. Apply and test the migrations. When satisfied, copy the new migration files to the `project_template/website/migrations/` directory. | ||
|
||
When making changes that are potentially destructive or backwards incompatible, increment the minor version number until coderedcms reaches a stable `1.0` release. Each production project that uses coderedcms should specify the appropriate version in its requirements.txt to prevent breakage. | ||
|
||
### Building pip packages | ||
To build a publicly consumable pip package, run: | ||
|
||
python setup.py sdist bdist_wheel | ||
|
||
which will build a source distribution and a wheel in the `dist/` directory. |
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,27 @@ | ||
Copyright (c) CodeRed LLC and individual contributors. | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, | ||
are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, | ||
this list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright | ||
notice, this list of conditions and the following disclaimer in the | ||
documentation and/or other materials provided with the distribution. | ||
|
||
3. Neither the name of CodeRed nor the names of its contributors may be used | ||
to endorse or promote products derived from this software without | ||
specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | ||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
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,4 @@ | ||
include LICENSE *.md *.rst *.txt | ||
graft coderedcms | ||
global-exclude __pycache__ | ||
global-exclude *.py[co] |
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,99 @@ | ||
# CodeRed CMS | ||
|
||
CodeRed CMS is a content management system built with [Wagtail](https://wagtail.io/) specifically geared towards marketing websites as a professionally-managed WordPress replacement. | ||
|
||
[Documentation](DOCS.md) | [CodeRed](https://www.coderedcorp.com/) - makers of CodeRed CMS. | ||
|
||
|
||
|
||
## Quick start | ||
1. Run `pip install coderedcms` | ||
|
||
2. Run `coderedcms start mysite` | ||
|
||
3. Run `python manage.py migrate` to create the core models. | ||
|
||
4. Run `python manage.py createsuperuser` to create the initial admin user. | ||
|
||
5. Run `python manage.py runserver` to launch the development server, and go to `http://localhost:8000` in your browser, or `http://localhost:8000/admin/` to log in with your admin account. | ||
|
||
See the [documentation](DOCS.md) for next steps and customizing your new site. | ||
|
||
|
||
|
||
## Why use CodeRed CMS? | ||
In addition to the numerous benefits of [Wagtail](https://wagtail.io/features/), CodeRed has features that are *great* for marketing websites: | ||
|
||
* **The entire editing experience is tailored for marketing content.** Create flashy hero units, callouts, and forms using a beautiful editing interface. Full SEO attributes and detailed Google Analytics tracking is enabled out of the box. Editors and Designers can easily update content, designs, and layout without fear of breakage and without the need to consult developers. Developers can fully customize the site without relying on plugins or undocumented hacks. | ||
|
||
* **Built-in SEO** including Opengraph, structured data, and many other meta tags automatically applied. A sitemap and robots.txt are also present and automatically updated. Articles and blog posts support Google’s preferred AMP format. | ||
|
||
* **Responsive design** out of the box! Editors can build content using [Bootstrap 4](https://getbootstrap.com/) components including navbars, hero units, carousels, cards, modals, and the powerful grid system. | ||
|
||
* **Fast load times** made possible by a built-in page cache. The cache automatically refreshes whenever a page is published, or by the click of a button. Cached pages load as quickly as static HTML files. | ||
|
||
* **Full Google Analytics tracking** can be turned on by adding your UA- tag. Detailed event tracking can be turned on globally and fine-tuned for each clickable element such as links, buttons, and images. | ||
|
||
* **Professionally-backed support**. Both CodeRed CMS and Wagtail (the technology powering CodeRed CMS) are produced by software companies who offer professional support and services. This is built on proven technology that successfully serves small businesses and large enterprises around the world every day. [Find a developer near you](https://madewithwagtail.org/developers/). | ||
|
||
|
||
|
||
## Roadmap | ||
Officially, CodeRed CMS is in a beta stage. That being said, it is currently in use on production sites. However there are still many activities that are needed before hitting a 1.0 “stable” status. | ||
|
||
Work already in progress before 1.0 release: | ||
|
||
* Higher test coverage. | ||
|
||
* Full documentation via sphynx/readthedocs. | ||
|
||
* Usability feedback and testing regarding the admin/editor experience. | ||
|
||
* Improved accessibility of the CodeRed-provided HTML templates (excluding the admin interface... this is an issue wagtail is dealing with upstream). | ||
|
||
Other future plans: | ||
|
||
* Continue adding commonly used abstract page types and blocks available out of the box(e.g. calendar/events, product page, store locator, etc.) | ||
|
||
* Continue updating and enhancing SEO/meta attributes as standards evolve. | ||
|
||
* Built-in SSO with major identity providers such as Google and Office 365. | ||
|
||
* ADA compliance enforcement features and workflows in the admin. | ||
|
||
* Light e-commerce functionality, or at least a smooth integration with an existing e-commerce framework. | ||
|
||
|
||
|
||
## Inspiration and Design Philosophy | ||
|
||
### Inspiration from WordPress | ||
We the creators of CodeRed CMS deal with WordPress sites on a daily basis. While WordPress is fantastic for blogs and do-it-yourself websites, we feel it is very frustrustrating for use in a professional environment where the site needs to be actively enhanced, maintained, and secured on a daily basis. We designed CodeRed CMS as a marketing-focused WordPress replacement, *not* a WordPress clone. The intended audience is an agency, technology firm, business, or non-profit who has at least one full stack web developer managing the website. | ||
|
||
WordPress users will feel comfortable with CodeRed CMS, as many of the editing and design paradigms are similar such as: | ||
|
||
* Global site and branding settings. | ||
|
||
* Main menu builder is familiar. | ||
|
||
* Editors can change the template used by each page. | ||
|
||
PLUS many aspects are greatly enhanced: | ||
|
||
* Visual content blocks eliminate need for cryptic short-codes. | ||
|
||
* Content blocks can each be customized with CSS classes and selectable templates. | ||
|
||
* Developers can easily customize the editing interface and page types without 3rd party plugins or themes. | ||
|
||
* The site can be professionally managed with better control over 3rd party plugins to prevent unplanned breakage (if you've ever managed a large WordPress site - you know exactly how painful this is). | ||
|
||
### As an Extension of Wagtail | ||
CodeRed CMS is a pip package that essentially wraps Wagtail and provides marketing-specific features that are ready to be used out of the box. Everything that can be done with Wagtail can be done with CodeRed. | ||
|
||
One major point of difference between between CodeRed and stock Wagtail is the approach to design and content. Wagtail being more of a CMS framework, is focused on a clear separation between design (UX) and content. We agree with this approach for larger informational sites. But as is usually the case with marketing sites, design and information are more tightly coupled. Developers shouldn’t *need* to create a new page type or a new block just to handle a design deviation that is used in one place on the site. Designers and editors shouldn’t *need* to engage the developer for every minor design-related change such as changing a CSS class. For this reason, CodeRed blurs the lines of design and content by enabling editors to specify templates on a per-page and per-block basis, CSS classes per-block, and many other logo, layout, and branding settings. We realize this is not the right approach for every site - but we do believe it adds a lot of value for marketing sites. | ||
|
||
|
||
|
||
## Contact | ||
We would love to hear your questions, comments, and feedback. Contact us on github or at [email protected]. |
Empty file.
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,10 @@ | ||
from django.conf.urls import include, url | ||
from wagtail.admin import urls as wagtailadmin_urls | ||
from coderedcms.views import clear_cache | ||
from coderedcms.settings import cr_settings | ||
|
||
|
||
urlpatterns = [ | ||
url(r'^codered/clearcache$', clear_cache, name="clear_cache"), | ||
url(r'', include(wagtailadmin_urls)), | ||
] |
Empty file.
Oops, something went wrong.