-
Notifications
You must be signed in to change notification settings - Fork 15
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 f5e53b5
Showing
45 changed files
with
5,251 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,4 @@ | ||
# Sphinx build info version 1 | ||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. | ||
config: 5b1e4fa9835d01e6ad9e29197e6c7b30 | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,51 @@ | ||
.. _changelog: | ||
|
||
========= | ||
Changelog | ||
========= | ||
|
||
.. _v_0_4_2: | ||
|
||
0.4.2 (2023-06-07) | ||
------------------ | ||
|
||
* Fixed the missing Sign In with Google button in the `auth/pages/login.html` template (:issue:`38`) | ||
* Fixed an incorrect assign of the Google account name to `user.email` when creating the account with Google (:issue:`38`) | ||
|
||
.. _v_0_4_1: | ||
|
||
0.4.1 (2023-06-06) | ||
------------------ | ||
|
||
* Fixed `createsuperuser` command (:issue:`36`) | ||
|
||
.. _v_0_4_0: | ||
|
||
0.4.0 (2023-01-27) | ||
------------------ | ||
|
||
* Added sign in with Google (:issue:`8`) | ||
|
||
.. _v_0_3_0: | ||
|
||
0.3.0 (2023-01-18) | ||
------------------ | ||
|
||
* Added a `docker-compose.yml` file to set up Postgres and Redis instances (:issue:`23`) | ||
* Changed index template to add links to documentation and source code (:issue:`23`) | ||
|
||
.. _v_0_2_0: | ||
|
||
0.2.0 (2023-01-17) | ||
------------------ | ||
|
||
* Added a pre-populated `.env` file (:issue:`20`) | ||
|
||
.. _v_0_1_0: | ||
|
||
0.1.0 (2023-01-17) | ||
------------------ | ||
|
||
* Added billing with Stripe (:issue:`6`) | ||
|
||
* Added authentication with custom user model (:issue:`4`) |
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 @@ | ||
.. _development: | ||
|
||
========================= | ||
Development | ||
========================= | ||
|
||
After you have generated your project, there are a few things missing in your development environment to get started: | ||
|
||
* Install project requirements | ||
* Create and connect a Postgres database | ||
* Run database migrations | ||
* Create and connect a Redis instance | ||
* Set up a Stripe project and product | ||
* Set up Sign in with Google | ||
* Install Tailwind dependencies | ||
|
||
We will walk you through each step with what we consider the faster approach. If you know how to do it in another way, fell free to deviate. | ||
|
||
The first step is to install the project requirements. | ||
|
||
Install project requirements | ||
---------------------------- | ||
|
||
Open your terminal in the project root | ||
|
||
.. code-block:: sh | ||
pip install -r requirements.txt | ||
This will install all the requirements to develop, format, lint and write docs for your project. | ||
|
||
Next up is setting up Postgres and Redis. | ||
|
||
Set up Postgres and Redis instances | ||
----------------------------------- | ||
|
||
We've built Django Rocket having Postgres in mind so we'll guide you through setting one up. We'll do it using `Docker Compose`_. If you don't have Compose installed, go over to `Install Compose`_ and then come back. | ||
|
||
.. _Docker Compose: https://docs.docker.com/compose/ | ||
.. _Install Compose: https://docs.docker.com/compose/install/ | ||
|
||
Your initial project ships with a :code:`docker-compose.yml` file in the root. Here's how it looks: | ||
|
||
.. code-block:: yaml | ||
version: "3.1" | ||
services: | ||
postgres: | ||
image: postgres:latest | ||
restart: always | ||
environment: | ||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD} | ||
- POSTGRES_DB=${POSTGRES_DB} | ||
ports: | ||
- "5432:5432" | ||
redis: | ||
image: bitnami/redis:latest | ||
restart: always | ||
environment: | ||
- ALLOW_EMPTY_PASSWORD=yes | ||
ports: | ||
- "6379:6379" | ||
Since Django Rocket also ships with a pre-populated :code:`.env` file, the :code:`POSTGRES_PASSWORD` and :code:`POSTGRES_DB` environment variables have already been set for you. All is left to do is run compose | ||
|
||
.. code-block:: sh | ||
docker compose up | ||
Now that the database is up we can run the project migrations. | ||
|
||
Run migrations | ||
-------------- | ||
|
||
To run the project migrations, in your terminal | ||
|
||
.. code-block:: sh | ||
python src/manage.py migrate | ||
Notice we expect the :code:`manage.py` file to be in the :code:`src` directory. | ||
|
||
.. note:: | ||
For a detailed description of the initial project directory, see :doc:`Initial project structure <initial-project-structure>`. | ||
|
||
The final before being able to run your project is setting up Stripe. | ||
|
||
Set up Stripe | ||
------------- | ||
|
||
For this step, you will need a `Stripe`_ account. Once you are registered in Stripe, navigate to the `dashboard`_ and click on `Developers`_ and in the left sidebar click `API keys`_. | ||
|
||
.. _Stripe: https://stripe.com/ | ||
.. _dashboard: https://dashboard.stripe.com/dashboard | ||
.. _Developers: https://dashboard.stripe.com/test/developers | ||
.. _API keys: https://dashboard.stripe.com/test/apikeys | ||
|
||
From here, you will create a new secret key. The resulting publishable key and secret key should be stored in your :code:`.env` under the keys :code:`STRIPE_PUBLISHABLE_KEY` and :code:`STRIPE_SECRET_KEY`. | ||
|
||
Now navigate to `Webhooks`_ and add a webhook endpoint. The URL should be :code:`https://<HOST>/billing/stripe/webhook/`. Make sure to replace :code:`<HOST>` with your host. | ||
|
||
.. _Webhooks: https://dashboard.stripe.com/test/webhooks | ||
|
||
The final step is to create a product. Navigate to the `Products`_ tab. Click on "Add a product" and make sure you select "Recurring" under "Price". Django Rocket expects your product to be a subscription. | ||
|
||
.. _Products: https://dashboard.stripe.com/test/products?active=true | ||
|
||
Fill all the information for your product and once you are done hit save. Then collect the price id and set it in your :code:`.env` under the key :code:`STRIPE_PRICE_ID` | ||
|
||
And that's it with Stripe. Next is Sign in with Google | ||
|
||
|
||
Set up Sign in with Google | ||
-------------------------- | ||
|
||
Open the `Google Developer Console`_. If you don't have a developer account sign up for one. | ||
|
||
.. _Google Developer Console: https://console.developers.google.com | ||
|
||
`Create a new project`_ for your website. Once you have your project created navigate to `APIs & Services`_, select the `Credentials`_ tab and create a new OAuth client ID with Web application application type. Assign the resulting client id and secret to :code:`GOOGLE_OAUTH_CLIENT_ID` and :code:`GOOGLE_OAUTH_CLIENT_SECRET` respectively in your :code:`.env` file. | ||
|
||
.. _Create a new project: https://console.cloud.google.com/projectcreate | ||
.. _APIs & Services: https://console.cloud.google.com/apis/dashboard | ||
.. _Credentials: https://console.cloud.google.com/apis/credentials | ||
|
||
Add :code:`http://localhost` and :code:`http://localhost:8000` to the Authorized JavaScript origins and :code:`http://localhost:8000/login/google/` to Authorized redirect URIs and make sure to hit save. | ||
|
||
We're done with Google. The last step is installing Tailwind dependencies. | ||
|
||
Install Tailwind dependencies | ||
----------------------------- | ||
|
||
To Install Tailwind dependencies head over to the terminal | ||
|
||
.. code:: sh | ||
python src/manage.py tailwind install | ||
Now you are ready to run your project | ||
|
||
Running the project | ||
------------------- | ||
|
||
There are two processes you need running while developing. The first one watches your styles and writes to your stylesheets to include relevant Tailwind utilities | ||
|
||
.. code:: sh | ||
python src/manage.py tailwind start | ||
The second one is your familiar Django server | ||
|
||
.. code:: sh | ||
python src/manage.py runserver | ||
That's it for setting up your development environment. | ||
|
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,120 @@ | ||
Django Rocket | ||
============= | ||
|
||
**A Django SaaS boilerplate** | ||
|
||
Django Rocket is an almost-ready-to-launch boilerplate framework powered by `Cookiecutter`_. | ||
|
||
.. _Cookiecutter: https://github.com/cookiecutter/cookiecutter | ||
|
||
It was initially built to allow me to launch my SaaS projects without having to copy-paste common code, so expect the design decisions and integrations to be targeted for this purpose. | ||
|
||
Requirements | ||
------------ | ||
|
||
To get started, you need to install the dependencies | ||
|
||
* `cookiecutter`_ | ||
* `django`_ | ||
|
||
.. _cookiecutter: https://github.com/cookiecutter/cookiecutter | ||
.. _django: https://github.com/django/django | ||
|
||
You can install them via `pip`_ | ||
|
||
.. _pip: https://github.com/pypa/pip | ||
|
||
.. code-block:: sh | ||
pip install cookiecutter==2.1.1 django==4.1.4 | ||
.. note:: | ||
Django Rocket works with other versions of Cookiecutter and Django, but it lacks extensive test coverage so there may be small errors. For now it's better to stick to the mentioned versions. | ||
|
||
Usage | ||
----- | ||
|
||
To build your project with cookiecutter | ||
|
||
.. code-block:: sh | ||
cookiecutter gh:ErnestoFGonzalez/djangorocket | ||
You'll be prompted to enter some information | ||
|
||
.. code-block:: sh | ||
project_name [My Project]: | ||
project_slug [my_project]: | ||
Output | ||
------ | ||
|
||
Running this command will create a directory called :code:`my_project` inside the current folder. Inside :code:`my_project`, you'll have the initial project structure: | ||
|
||
:: | ||
|
||
my_project | ||
├── requirements | ||
│ ├── requiremens-dev.txt | ||
│ ├── requiremens-docs.txt | ||
│ ├── requiremens-linting.txt | ||
│ ├── requiremens-testing.txt | ||
│ └── requirements.txt | ||
├── src | ||
│ ├── my_project | ||
│ │ ├── auth | ||
│ │ ├── billing | ||
│ │ ├── utils | ||
│ │ ├── __init__.py | ||
│ │ ├── asgi.py | ||
│ │ ├── celery.py | ||
│ │ ├── context_processors.py | ||
│ │ ├── model_loaders.py | ||
│ │ ├── settings.py | ||
│ │ ├── urls.py | ||
│ │ ├── views.py | ||
│ │ └──wsgi.py | ||
│ ├── static | ||
│ ├── tailwind_theme | ||
│ ├── templates | ||
│ └── manage.py | ||
├── .env | ||
├── .env.example | ||
├── requiremens.txt | ||
└── runtime.txt | ||
|
||
For a deep dive, see :doc:`Initial project structure <initial-project-structure>`. | ||
|
||
Start developing | ||
---------------- | ||
|
||
In order to get started with your development there are a few things you need to do first: | ||
|
||
* Install project requirements | ||
* Create and connect a Postgres database | ||
* Run database migrations | ||
* Create and connect a Redis instance | ||
* Set up a Stripe project and product | ||
* Set up Sign in with Google | ||
* Install Tailwind dependencies | ||
|
||
Go to :doc:`Development <development>` for a step-by-step guide. | ||
|
||
License | ||
------- | ||
|
||
Django Rocket is distributed under the Apache License 2.0. You can `read the full license here`_. | ||
|
||
.. _read the full license here: https://github.com/ErnestoFGonzalez/djangorocket/blob/main/LICENSE.md | ||
|
||
.. toctree:: | ||
:hidden: | ||
|
||
self | ||
initial-project-structure | ||
development | ||
changelog | ||
|
||
|
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,39 @@ | ||
.. _initial-project-structure: | ||
|
||
========================= | ||
Initial project structure | ||
========================= | ||
|
||
After you generate your project, the initial project structure is | ||
|
||
:: | ||
|
||
[project_slug] | ||
├── requirements | ||
│ ├── requiremens-dev.txt | ||
│ ├── requiremens-docs.txt | ||
│ ├── requiremens-linting.txt | ||
│ ├── requiremens-testing.txt | ||
│ └── requirements.txt | ||
├── src | ||
│ ├── [project_slug] | ||
│ │ ├── auth | ||
│ │ ├── billing | ||
│ │ ├── utils | ||
│ │ ├── __init__.py | ||
│ │ ├── asgi.py | ||
│ │ ├── celery.py | ||
│ │ ├── context_processors.py | ||
│ │ ├── model_loaders.py | ||
│ │ ├── settings.py | ||
│ │ ├── urls.py | ||
│ │ ├── views.py | ||
│ │ └──wsgi.py | ||
│ ├── static | ||
│ ├── tailwind_theme | ||
│ ├── templates | ||
│ └── manage.py | ||
├── .env | ||
├── .env.example | ||
├── requiremens.txt | ||
└── runtime.txt |
Oops, something went wrong.