Skip to content

Project initialization environment improvements #175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 35 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,31 +48,31 @@ modern stack.

## Table of Contents

- [Background](#background)
- [Quick Start](#quick-start)
- [Develop](#develop)
- [Admin Dashboard](#admin-dashboard)
- [Security](#security)
- [Testing](#testing)
- [Fixtures](#fixtures)
- [test_db](#test_db)
- [test_user](#test_user)
- [test_superuser](#test_superuser)
- [client](#client)
- [user_token_headers](#user_token_headers)
- [superuser_token_headers](#superuser_token_headers)
- [Background Tasks](#background-tasks)
- [Flower](#flower)
- [Frontend Utilities](#frontend-utilities)
- [Utility Functions](#utility-functions)
- [login](#login)
- [logout](#logout)
- [isAuthenticated](#isauthenticated)
- [Routes](#routes)
- [Higher Order Components](#higher-order-components)
- [PrivateRoute](#privateroute)
- [Deployment](#deployment)
- [Contributing](#contributing)
- [Background](#background)
- [Quick Start](#quick-start)
- [Develop](#develop)
- [Admin Dashboard](#admin-dashboard)
- [Security](#security)
- [Testing](#testing)
- [Fixtures](#fixtures)
- [test_db](#test_db)
- [test_user](#test_user)
- [test_superuser](#test_superuser)
- [client](#client)
- [user_token_headers](#user_token_headers)
- [superuser_token_headers](#superuser_token_headers)
- [Background Tasks](#background-tasks)
- [Flower](#flower)
- [Frontend Utilities](#frontend-utilities)
- [Utility Functions](#utility-functions)
- [login](#login)
- [logout](#logout)
- [isAuthenticated](#isauthenticated)
- [Routes](#routes)
- [Higher Order Components](#higher-order-components)
- [PrivateRoute](#privateroute)
- [Deployment](#deployment)
- [Contributing](#contributing)

## Background

Expand Down Expand Up @@ -113,15 +113,16 @@ You will need to put in a few variables and it will create a project directory

<details><summary>Input Variables</summary>

- project_name [default fastapi-react-project]
- project_slug [default fastapi-react-project] - this is your project directory
- port [default 8000]
- postgres_user [default postgres]
- postgres_password [default password]
- postgres_database [default app]
- superuser_email [default [email protected]]
- superuser_password [default password]
- secret_key [default super_secret]
- project_name [default "FastAPI React Project"]
- project_slug [default "fastapi-react-project"] - this is your project directory
- project_namespace [default "fastapi_react_project"]
- project_port [default 8000]
- postgres_database [default "fastapi_react_project_db"]
- postgres_user [default "postgres"]
- postgres_password [default random_ascii_string(32)]
- superuser_email [default "[email protected]"]
- superuser_password [default random_ascii_string(32)]
- secret_key [default random_ascii_string(128, punctuation=True)]

</details>

Expand Down
20 changes: 12 additions & 8 deletions cookiecutter.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
{
"project_slug": "fastapi-react-project",
"project_name": "{{ cookiecutter.project_slug }}",
"port": "8000",
"project_name": "FastAPI React Project",
"project_slug": "{{ cookiecutter.project_name | slugify }}",
"project_namespace": "{{ cookiecutter.project_slug | replace('-', '_') }}",
"project_port": 8000,

"secret_key": "{{ random_ascii_string(128) }}",

"postgres_database": "{{ cookiecutter.project_namespace }}_db",
"postgres_user": "postgres",
"postgres_password": "password",
"postgres_database": "app",
"superuser_email": "admin@{{cookiecutter.project_name}}.com",
"superuser_password": "password",
"secret_key": "super_secret"
"postgres_password": "{{ random_ascii_string(32) }}",

"superuser_email": "[email protected]",
"superuser_password": "{{ random_ascii_string(32) }}"
}
6 changes: 6 additions & 0 deletions hooks/post_gen_project.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import subprocess

subprocess.call(['mv', '.project-gitignore', '.gitignore'])
subprocess.call(['git', 'init'])
subprocess.call(['git', 'add', '--all'])
subprocess.call(['git', 'commit', '-m', 'init project with cookiecutter'])
16 changes: 16 additions & 0 deletions {{cookiecutter.project_slug}}/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
PROJECT_NAME={{cookiecutter.project_name}}
PROJECT_SLUG={{cookiecutter.project_slug}}
PROJECT_NAMESPACE={{cookiecutter.project_namespace}}
PROJECT_PORT={{cookiecutter.project_port}}

SECRET_KEY={{cookiecutter.secret_key}}
DEBUG=True

POSTGRES_DB={{cookiecutter.postgres_database}}
POSTGRES_USER={{cookiecutter.postgres_user}}
POSTGRES_PASSWORD={{cookiecutter.postgres_password}}

DATABASE_URL=postgresql://{{cookiecutter.postgres_user}}:{{cookiecutter.postgres_password}}@postgres:5432/{{cookiecutter.postgres_user}}

SUPERUSER_EMAIL={{cookiecutter.superuser_email}}
SUPERUSER_PASSWORD={{cookiecutter.superuser_password}}
4 changes: 4 additions & 0 deletions {{cookiecutter.project_slug}}/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* text=auto

*.conf text eol=lf
*.sh text eol=lf
Loading