Cookbooks¶
Step-by-step guide to some different you might want to do with Pegasus.
Pegasus customers can request content be added to this page! Just get in touch via support.
Use the Django Admin UI¶
Pegasus ships with a simple script to promote any user to a superuser who can access the Django admin.
After going through the sign up flow, to convert your newly-created user into an admin, run the following command, being sure to replace the email address with the one you used to sign up:
python ./manage.py promote_user_to_superuser yourname@example.com
Now you should be able to access the django admin at http://localhost:8000/admin
Delete Pegasus Examples¶
The Pegasus examples are great for seeing a fully-working end-to-end feature, but in your app you probably don’t want them around long term. To remove the examples entirely, take the following steps:
Cleaning the back-end code¶
- In
settings.py
, remove'pegasus.apps.examples.apps.PegasusExamplesConfig'
fromPEGASUS_APPS
. - In your root
urls.py
, remove the line containinginclude('pegasus.apps.examples.urls')
. - In
apps/web/templates/web/components/top_nav.html
, remove the section linking to the Examples Gallery. - Delete the entire
pegasus/apps/examples
directory. - Delete the entire
templates/pegasus/examples
directory.
Cleaning the front-end code¶
- In
assets/index.js
remove therequire('./javascript/pegasus/examples/object-lifecycle.js');
and'./javascript/pegasus/pegasus.js'
lines. - In
webpack.config.js
, delete the'object-lifecycle'
and'pegasus'
entries frommodule.exports
. - Delete the
assets/javascript/pegasus/
folder. - Delete
static/js/object-lifecycle-bundle.js
andstatic/js/pegasus-bundle.js
Delete Teams Code¶
If you aren’t using teams there are a few things you can cleanup on the front end code.
- In
assets/index.js
remove therequire('./javascript/pegasus/teams.js');
line. - In
webpack.config.js
, delete theteams
entry frommodule.exports
. - Delete
assets/javascript/pegasus/teams.js
. - Delete
static/js/teams-bundle.js
Delete Stripe Code¶
If you aren’t using Stripe you can remove the code and dependencies by doing the following steps.
Note that this requires starting from a fresh database, or manually manipulating your migrations.
- In
settings.py
removedjstripe
fromTHIRD_PARTY_APPS
- In
settings.py
removeSTRIPE_
andDJSTRIPE_
settings - Delete
apps/utils/decorators.py
- Delete
templates/stripe
directory - Delete the
@import "stripe.sass"
line fromassets/styles/app/_all.sass
- Delete
assets/styles/app/stripe.sass
If you have not removed the examples using the method above, you also need to delete the payments example. This can be done with the following steps:
- Delete the paths starting with
/payments/
frompegasus/apps/examples/urls.py
. - Delete references to
Payment
frompegasus/apps/examples/admin.py
. - In
pegasus/apps/examples/views/__init__.py
delete linefrom .payments import *
- Delete
pegasus/apps/examples/views/payments.py
. - In
pegasus/apps/examples/models/__init__.py
delete linefrom .payments import Payment
- Delete
pegasus/apps/examples/models/payments.py
. - Delete the relevant sections of
templates/pegasus/examples/examples_home.html
andtemplates/pegasus/examples/components/examples_nav.html
- Delete the
templates/pegasus/examples/payments/
folder. - In
assets/javascript/app.js
removeexport { Payments } from './Payments';
line. - Delete
assets/javascript/payments.js
. - Run
./manage.py makemigrations
and./manage.py migrate
Finally, remove the library dependencies:
- In
requirements/requirement.in
andrequirements/requirement.txt
removestripe
anddj-stripe
lines. - Run
pip-sync