Skip to content

Django boiler plate code for any generic SAAS tool

Notifications You must be signed in to change notification settings

encryptblockr/simple-django-saas

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

simple-saas

  • This django project is meant to serve as a boilerplate code for building any saas tool

  • The directory saas serves as a django app with all the boilerplate code

  • django-rest-framework is used for authentication and creating apis. Please refer to this if not familiar with django-rest-framework since this project heavily relies on it.

  • business logic for all APIs is present in serializers.

  • to use this as a library, refer to this

Signup

curl -XPOST 'http://localhost:8000/saas/signup' -d '{"business": {"name": "test inc"}, "email": "[email protected]", "first_name": "sankalp", "last_name": "jonna", "password1": "pleasepass", "password2": "pleasepass"}' -H "Content-type: application/json"

Login

curl -XPOST 'http://localhost:8000/saas/login' -d '{"email": "[email protected]", "password": "pleasepass"}' -H "Content-type: application/json"

Reset password

curl -XPOST 'http://localhost:8000/saas/passwd/reset' -d '{"email": "[email protected]"}' -H "Content-type: application/json"

Reset password confirmation

curl -XPOST 'http://localhost:8000/saas/passwd/reset/cnfrm' -d '{"activation_key": "<activation_key>", "password1": "sankalp", "password2": "sankalp"}' -H "Content-type: application/json"

Me

curl -XGET 'http://localhost:8000/saas/me' -H "Authorization: Token <token>"

Invite

curl -XPOST 'http://localhost:8000/saas/invite' -H "Authorization: Token 534fe89f5d6b9ff214e8883d7b9664177002056a" -H "Content-Type: application/json" -d '{"email": "[email protected]"}'

Prefill Signup form

curl -XGET 'http://localhost:8000/saas/signup/prefill?key=<activation_key>'

Using as a library

If you feel that the current functionality is enough and you wish to simply use the saas app in your existing django project, follow these steps

Installation

pip install git+https://github.com/sankalpjonn/simple-saas

add saas and rest_framework to INSTALLED_APPS

INSTALLED_APPS = [
	'saas',

	'rest_framework.authtoken',
	'rest_framework',
]

add rest_framework settings

REST_FRAMEWORK = {
	'DEFAULT_AUTHENTICATION_CLASSES': (
		'rest_framework.authentication.TokenAuthentication',
	),
}

run migrations

python manage.py migrate

add to urls.py

in the root urls, add

urlpatterns = [
	url(r'^', include('django.contrib.auth.urls')),
	url(r'^admin/', admin.site.urls),
    url(r'^saas/', include('saas.urls')),
]

About

Django boiler plate code for any generic SAAS tool

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%