Git Product home page Git Product logo

imagineai / create-django-app Goto Github PK

View Code? Open in Web Editor NEW
69.0 7.0 9.0 170 KB

Django project starter on steroids: quickly create a Django app AND generate source code for data models + REST/GraphQL APIs (the generated code is auto-linted and has 100% test coverage).

Home Page: https://www.imagine.ai

License: MIT License

Dockerfile 2.51% Makefile 4.14% Python 93.08% Shell 0.27%
django crud-apis codegenerator autogenerated dsl compilers metaprogramming

create-django-app's Introduction

CodeQL codecov test across OS, package managers and Python versions

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 the todoapp.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 run imagine compile todoapp.im.

  • Have fun! ๐Ÿ’›

create-django-app's People

Contributors

anusheel avatar edu-d-rai avatar privahini avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

create-django-app's Issues

Hi! how I can see the demo?

(newspaper) peter@pop-os:~/Desktop/learn-django/django-app$ imagine demo django-app
โ€บ Error:
โ€บ
โ€บ SE000045 => Your object API "album-api-fetch-update" has an
โ€บ update action, so you have to specify a primary key and at
โ€บ least one field.. At django-app:104:1
โ€บ 104 โ”ƒ API album-api-fetch-update {
โ€บ 105 โ”ƒ model Album
โ€บ 106 โ”ƒ actions [Read,ReadMany,Update]
โ€บ 107 โ”ƒ permissions [permission-1]
โ€บ 108 โ”ƒ filter [name,num_stars]
โ€บ 109 โ”ƒ data [name,songs]
โ€บ 110 โ”ƒ }

will you add mongo support?

I am trying to implement your rapid development with your project, but I notice you dont support mongo . is there a way to support it ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.