💛
Create Django App We're a Django project starter on steroids!
One-line command to create a Django app with all the dependencies auto-installed
AND
Easy config (alpha release) to generate Django code for:
- setting up package managers (pipenv, poetry, virtualenv)
- setting web servers (dev, gunicorn, uwsgi)
- connecting to different databases (MySQL, PostgreSQL, SQLite3)
- data models
- CRUD API (REST, GraphQL)
- unit tests and test coverage reporting
- autogenerated test factories (FactoryBoy)
- linting and code formatting (autopep8, isort)
- API documentation (Swagger, ReDoc)
Quick start
- Run the following command to create your new Django app:
npm install -g imagine && imagine create -f django -n myapp
If you don't have npm
installed, you'll need to install this first.
- You should see this:
$ npm install -g imagine && imagine create -f django -n myapp
changed 214 packages, and audited 215 packages in 5s
....
found 0 vulnerabilities
32 files written
You have successfully created a new project!
Now you can run "cd myapp && imagine run" to install the dependencies and open a web server running at
http://127.0.0.1:8000/
-
Run
cd myapp && imagine run
to run your new Django app, and open http://127.0.0.1:8000/ to see that the install worked successfully. -
Congrats! Your Django app is up and running!
-
Now that you've created your new app, check out the
myapp.im
in your app directory - using this you can:- easily change your app settings such as Django server, package manager, API format, database etc.
- generate code for data models, CRUD APIs etc using our simple config spec.
-
Continue reading to learn more, or check out www.imagine.ai.
Learn more
Easy to create
-
Our one-line command allows your to get started with your Django app immediately, without worrying about installing dependencies - we take care of those, so you can focusing on writing business logic.
-
Our default settings when we create your Django app are as follows:
- Server: dev
- Package manager: pipenv
- Django models layout: single-file
- Project directory name: microservice
- API format: REST
- Database: sqlite3
- Database name: myapp-db
-
These aren't the exact settings you want? No sweat, you can always change the settings as per your preferences - read on to see how to do this.
Easy to customize
-
If you want to change any of the above defaults for your app, its a piece of cake.
-
Go to the myapp.im file in your directory, your should see the basic default settings here:
settings
app:
# your application name
name: myapp
# choose one: [django, node]
framework: django
django:
# choose one: [pipenv, poetry, virtualenv]
package-manager: pipenv
# choose one: [gunicorn, uwsgi, dev]
server: dev
layout:
# choose one: [single-file, separate-files]
models: single-file
# name of the project settings directory:
project-dir: microservice
api:
# choose one: [rest, graphql]
format: rest
end settings
# database <database-name> <database type: [sqlite, mysql, posgresql]>
database myapp-db sqlite3
- You can replace the default settings with your preferences (based on the options allowed), and then run
imagine compile myapp.im
in your terminal. Your app will be updated with the new settings.
Easy to add app functionality
-
Not only can you change your app settings easily, you can also generated production-ready code using the
myapp.im
file. -
Use Imagine's simple syntax to generate code for data models and CRUD APIs to your Django app.
-
Run
imagine compile myapp.im
to see the generated code. -
PS - all our generated code has:
- unit tests and test coverage reporting
- autogenerated test factories (using FactoryBoy)
- linting and code formatting (you can select autopep8 or isort)
- autogenerated API documentation (using Swagger and ReDoc)
-
PPS - in this repository, we have included an example to-do app that we created and generated using the
todoapp.im
file. You can check out thetodoapp.im
file that we used to create the Django app and express the specifications for the data models and APIs, as well as all the Django code files that are generated when you runimagine compile todoapp.im
. -
Have fun!
💛