Create an App
Information on how to create a Donation Store app
Apps can add extra functionality to Donation Store. They should be used when you want to add more functionality to Donation Store within the app which stretches further than just a theme or template.
As of writing this doc, we do not support Community Goals in Donation Store, even though we have plans to support it in the future. This would be an example of an app in Donation Store. It is advised to use apps instead of modifying the Donation Store code, both because it allows you to potentially distribute the app and you would want the app to be installed simply into any clean installation of Donation Store. It is also advised that you use an app because if an update comes out and you have to replace core code, you will have to re write any changes you originally made to Donation Store code.
Donation Store is built on the Django framework. This allows you to simply create separate apps that run alongside the main Donation Store code. Each app has some files that are:
- urls.py - A list of all URLs within that app and where they are pointed to
- views.py - The views that are included in your app
- models.py - The models for your app
- admin.py - The list of models that need to be registered
The templates associated with your app should be stored in the templates folder of Donation Store, in their own directory. To generate the boiler plate code for the app, you can use the built in Django command for it. Activate your virtual environment and run the following code:
django-admin startproject mysite
Once this is completed, you can continue developing your app whichever way you would like. To actually hit your root URL in your urls.py, you will have to edit the urls.py in the DonationStoreV2 file to add your URL with a given slug that is unique. Use a slug that adequately represents your app, for example your app name.