==========
Serve flat pages for a Vuejs frontend
* **Fast**: no database hits
* **Safe**: keep the pages in a version control system
* **Friendly**: edit the pages in an IDE
* **Cache**: client-side cache thanks to [Apollo client](https://www.apollographql.com/)
Installation
------------
``pip install django-sfp``
Configuration
-------------
1. Add ``"sfp",`` to your ``INSTALLED_APPS``
2. Declare the graphql schema in settings:
```python
GRAPHENE = {
'SCHEMA': 'sfp.schema.schema',
}
```
3. Add the graphql endpoint url:
```python
from django.views.decorators.csrf import csrf_exempt
from graphene_django.views import GraphQLView
urlpatterns = [
# ...
url(r'^graphql', csrf_exempt(GraphQLView.as_view())),
]
```
4. Install the frontend:
Grab the `Page.vue` component:
```bash
wget https://raw.githubusercontent.com/synw/django-sfp/master/frontend/src/components/Page.vue
```
Install the dependencies:
```
npm install --save vue-apollo // or vue add apollo if you use vue-cli
npm install --save @fortawesome/fontawesome-svg-core
npm install --save @fortawesome/free-solid-svg-icons
npm install --save @fortawesome/vue-fontawesome
```
Font-Awesome is for the spinner loading icon (only this icon will be included in the build,
not the whole lib). Vue-router must be installed
5. Add a frontend generic route:
```javascript
import Page from './path/to/my/components/Page.vue'
routes: [
// ...
{
path: '*',
name: 'Page',
component: Page
},
],
```
To make links: ``<router-link :to="{ name: 'Page', params: { 0: '/myurl' }}"></router-link>``
Usage
-----
Create a ``pages`` in the Django project static directory. Any html file you include there will get served as
a static page.
For example::
* The url ``/about/`` will render ``static/pages/about.html``
* The url ``/about/team/`` will render ``static/pages/about/team.html``
Note: the first line of each file is the title of the page: ex:
```html
My page title
<div>My page content</div>
```
Edit pages online
-----------------
To edit pages at runtime you can use [django-dirtyedit](https://github.com/synw/django-dirtyedit)
Metadata
Release files for django-sfp 0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| django-sfp-0.7.tar.gz | 3.8 kB | Without provenance | Details |
Release files / django-sfp-0.7.tar.gz
| Download URL | django-sfp-0.7.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
27d2f64a3c67f98c05967b18a6c413ed8f173056eeae4ae597a83840e02dac97
|
|
BLAKE2b-256 checksum How to use checksums |
94151508b2dfc7627b6ec0636da05b83d2aa0fec1e4b906abb9c54a8ab532130
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.9.1 pkginfo/1.4.1 requests/2.19.1 setuptools/40.1.0 requests-toolbelt/0.8.0 tqdm/4.14.0 CPython/2.7.15rc1
|
Security for django-sfp 0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.