Package: django-sage-painless
Django Sage PainlessThedjango-sage-painlessis a valuable package based on Django Web Framework & Django Rest Framework for high-level and rapid web development. The introduced package generates Django applications. After completing many projects, we concluded that any basic project and essential part is its database structure. You can give the database schema in this package and get some parts of the Django application, such as API, models, admin, signals, model cache, setting configuration, mixins, etc. All of these capabilities come with a unit test. So you no longer have to worry about the simple parts of Django, and now you can write your advanced services in Django. The django-sage-painless dramatically speeds up the initial development of your projects. Documentation of this package is available inreadthedocs.VisionHowever, we intend to make it possible to use it in projects that are in-progress.Why PainlessWe used the name painless instead of the Django code generator because this package allows you to reach your goals with less effort.Project DetailGet StartedUsageContributeGit RulesProject DetailLanguage: Python > 3.6Framework: Django > 3.1Getting StartedBefore creating Djagno project you must first create virtualenv.$python3.9-mpipinstallvirtualenv
$python3.9-mvirtualenvvenvTo activate virtualenvironment in ubuntu:$sourcevenv/bin/activateTo deactive vritualenvironment use:$deactivateStart ProjectFirst create a Django project$mkdirGeneratorTutorials
$cdGeneratorTutorials
$django-adminstartprojectkernel.Install GeneratorFirst install package$pipinstalldjango-sage-painlessThen add 'sage_painless' to INSTALLED_APPS in settings.pyTIP:You do not need to install the following packages unless you request to automatically generate an API or API documentation.However, you can add following apps in your INSTALLED_APPS:rest_frameworkdrf_yasgdjango_seedINSTALLED_APPS=['sage_painless','rest_framework','drf_yasg','django_seed',]UsageTo generate a Django app you just need a diagram in JSON format. diagram is a json file that contains information about database tables.Diagram examplesstart to generate
(it is required for development. you will run tests on this app)First validate your diagram format. It will raise errors if your diagram format is incorrect.$pythonmanage.pyvalidate_diagram--diagram<pathtodiagram>Now you can generate code (you need generate diagram json file)Generate diagram sample$pythonmanage.pygenerate--diagram<pathtodiagram>You can generate deploy config files (you need a deploy diagram json file)Deploy diagram sample$pythonmanage.pydeploy--diagram<pathtodeploydiagram>You can generate doc files (README, etc)$pythonmanage.pydocs--diagram<pathtodiagram>Here system will ask you what you want to generate for your app.If you generated api you have to add app urls to main urls.py:urlpatterns=[path('api/',include('products.api.urls')),]You have to migrate your new models$pythonmanage.pymakemigrations
$pythonmanage.pymigrateYou can run tests for your app$pythonmanage.pytestproductsDjango run server$pythonmanage.pyrunserverFor support Rest API doc add this part to your urls.pyfromrest_framework.permissionsimportAllowAnyfromdrf_yasg.viewsimportget_schema_viewfromdrf_yasgimportopenapischema_view=get_schema_view(openapi.Info(title="Rest API Doc",default_version='v1',description="Auto Generated API Docs",license=openapi.License(name="S.A.G.E License"),),public=True,permission_classes=(AllowAny,),)urlpatterns=[path('api/doc/',schema_view.with_ui('redoc',cache_timeout=0),name='schema-swagger-ui'),]Rest API documentation is available atlocalhost:8000/api/doc/How to ContributeRun project tests before starting to developproductsapp is required for running tests$pythonmanage.pystartappproductsINSTALLED_APPS=['products',]you have to generate everything for this appdiagram file is available here:Diagramdownload diagram file and generate test app using this commend$pythonmanage.pygenerate--diagramtests/diagrams/product_diagram.jsonrun tests$pythonmanage.pytestsage_painlessGit RulesS.A.G.E. team Git Rules Policy is available here:S.A.G.E. Git PolicyTeamSepehr Akbarazadeh MaintainerMehran Rahmanzadeh MaintainerVersion 1generate README.mddb encryptionvideo streamingimprove test generationcoverage & toxdeployment questionnairemanagement commanddockergunicorn, uwsgi, etcnginx configurationcommit generationGitHub repo integrationCI CDDatabase Support (postgres, mysql, sqlite, sql server)security config and checkseographqlpackage manager supportVersion 2Django admin generatormodular settingmock data generatorfile field svg supportimage field enhancementtraditional mixinsdecorator signalslogging configurationsentry supportmonitoring feature (prometheus)track data historystream uploadCORS configmongo supportElastic search configurationcache support (+Memcache)error handlers (2xx, 3xx, 4xx, 5xx)django forms supportdjango view supportimage compression supportdebug tools support