项目作者: app-generator

项目描述 :
App Generator - Deliver your projects faster | AppSeed
高级语言:
项目地址: git://github.com/app-generator/app-generator.git
创建时间: 2019-05-27T05:14:04Z
项目社区:https://github.com/app-generator/app-generator

开源协议:

下载


Open-Source App Generator

Open-Source Tools for solo-devs, students and companies - Generate Digital Products,
Update legacy code by chat, Inject new modules, Software Auto-healing, AI, Deployment automation (any provider), Docker, K8s.


Features


Stack

  • Python/Django
  • React
  • Docker
  • CI/CD - LIVE Deploy on Digital Ocean


Manual Build

Step #1 - Download the code

  1. $ git clone https://github.com/app-generator/app-generator.git
  2. $ cd app-generator

Step #2 - Install modules

  1. $ virtualenv env
  2. $ source env/bin/activate
  3. $ pip install -r requirements.txt

Step #3 - Set Up Database

  1. $ python manage.py makemigrations
  2. $ python manage.py migrate

Step #4 - Create the ENV file

The .env can be created from the env.sample file, provided in the root of the project

  1. $ cp env.sample .env

Step #5 - Compile UI (that uses Tailwind)

  1. $ pnpm i
  2. $ pnpm run build

Step #5 - Execute collectstatic for Django statics

  1. $ python manage.py collectstatic
  2. $ python manage.py migrate

Start the APP

  1. $ python manage.py createsuperuser # create the admin
  2. $ python manage.py runserver # start the project

At this point, the app runs at http://127.0.0.1:8000/.


Compile Documentation

The Documentation being generated by , the compilation requires a linux box

  1. $ cd docs && rm -rf build && make html
  2. # Or via a while loop
  3. $ cd docs ; while true ; do rm -rf build/ ; make html ; sleep 10 ; done

The output is saved on docs/build and rendered on /docs/ URI


CLI Interface

All CLI tools are listed by dev_tools subcommand:

$ python manage.py dev_tools

Below sections explains each dev_tool added to the codebase - If somethings is not working in your environment, please contact support.

Generate Code

Django Starters

  1. $ python manage.py tool_generator -f sources/input-django-template-soft.json # Generate a new Django Starter, Soft Design

Flask Starters

  1. $ python manage.py tool_generator -f sources/input-flask-template-datta.json # Generate a new Flask Starter, Datta Able Design

The generated code is saved in generated_code DIR. Open the sources using your favorite editor and start the project.


Generate Project Template

Using this tool, we can generate a JSON template used later by the generator

  1. $ python manage.py tool_generator_interactive_django -i # Print HELP
  2. $ python manage.py tool_generator_interactive_django # Generate JSON File
  3. $ python manage.py tool_generator_interactive_flask # Generate JSON File
  4. ...
  5. # (Truncated Output)
  6. $ python manage.py tool_generator_interactive_django
  7. [?] Project Friendly Name: Some Django project
  8. [?] The Backend Framework:
  9. > django
  10. flask (soon)
  11. nodejs (soon)
  12. [?] The UI Kit:
  13. > datta
  14. volt
  15. soft-dashboard
  16. [?] The Database:
  17. > sqlite
  18. mysql
  19. pgsql
  20. ...
  21. # (Truncated Output)
  22. ...
  23. > File saved = sources\Nt5QWHGI_django_template.json
  24. > HOW to generate code:
  25. |-- python manage.py tool_generator -f sources/Nt5QWHGI_django_template.json

By running the sugegsted command, we should be able to generate a valid Django Project.


Upload to GitHub

Note: For having SUCCESS on this operation, a GITHUB_KEY is required in .env - read more.

  1. $ python manage.py tool_github_uploader -i # Print HELP
  2. $ python manage.py tool_github_uploader -d generated_code/GENERATED_PROJECT -k GITHUB_KEY

Once the operation is finished, the generated project should be saved under the account associated with the GITHUB_KEY.


Inspect DB (sqlite, MySql, PgSql)

  1. # SQLite scan
  2. $ python manage.py tool_db_processor -f media/tools/db_inspect/db_sqlite.json
  3. # OR
  4. # MySql scan
  5. $ python manage.py tool_db_processor -f media/tools/db_inspect/db_mysql.json
  6. ...
  7. # (Truncated Output)
  8. > Processing media/tools/db_inspect/db_sqlite.json
  9. |-- type : db
  10. |-- DB driver : SQLITE
  11. |-- DB name : media/tools/common/sample.sqlite3
  12. |-- DB host : None
  13. |-- DB port : None
  14. |-- DB user : None
  15. |-- DB pass : None
  16. > Dump data for [api_user_user]
  17. > Dump data for [api_authentication_activesession]
  18. > Dump data for [auth_group]
  19. > Dump data for [api_user_user_groups]
  20. > Dump data for [django_content_type]
  21. > Dump data for [auth_permission]
  22. > Dump data for [api_user_user_user_permissions]
  23. > Dump data for [auth_group_permissions]
  24. > Dump data for [django_admin_log]
  25. > Dump data for [django_migrations]
  26. > Dump data for [django_session]

The SQL dump is done in the tmp DIRECTORY

  1. ROOT
  2. |-- tmp
  3. |-- 05_27_58_SQLITE.sql
  4. |-- 05_28_04_SQLITE_api_user_user


Migrate DB

Note: the feature works with SQLite, MySql and PostgreSQL.

The source and target DB credentials should be provided in JSON format. Here are the provided samples

How to use it:

  1. $ python manage.py tool_db_migrator -s DB_SOURCE.json -t DB_TARGET.json # Perform Checks
  2. $ python manage.py tool_db_migrator -s DB_SOURCE.json -t DB_TARGET.json --migrate # Migrate the data


CSV processor

Authenticated users can process CSV files and apply transformers.

DEMO: https://app-generator.dev/tools/csv-processor/


Inspect CSV Files

  1. $ python manage.py tool_inspect_source -f media/tools/csv/csv_inspect.json # Truncated output
  2. $ python manage.py tool_inspect_source -f media/tools/csv/csv_inspect.json -k # Print all rows
  3. # OR for distant CSV files
  4. $ python manage.py tool_inspect_source -f media/tools/csv/csv_inspect_distant.json
  5. ...
  6. # (Truncated Output)
  7. > Processing media/tools/csv/csv_inspect.json
  8. |-- file: media/tools/csv/titanic.csv
  9. |-- type: csv
  10. {'PassengerId': {'type': 'int64'}, 'Survived': {'type': 'int64'}, 'Pclass': {'type': 'int64'}, 'Name': {'type': 'object'}, 'Sex': {'type': 'object'}, 'Age': {'type': 'float64'}, 'SibSp': {'type': 'int64'}, 'Parch': {'type': 'int64'}, 'Ticket': {'type': 'object'}, 'Fare': {'type': 'float64'}, 'Cabin': {'type': 'object'}, 'Embarked': {'type': 'object'}}
  11. [1] - PassengerId,Survived,Pclass,Name,Sex,Age,SibSp,Parch,Ticket,Fare,Cabin,Embarked
  12. [2] - 1,0,3,"Braund, Mr. Owen Harris",male,22,1,0,A/5 21171,7.25,,S
  13. [3] - 2,1,1,"Cumings, Mrs. John Bradley (Florence Briggs Thayer)",female,38,1,0,PC 17599,71.2833,C85,C
  14. [4] - 3,1,3,"Heikkinen, Miss. Laina",female,26,0,0,STON/O2. 3101282,7.925,,S
  15. [5] - 4,1,1,"Futrelle, Mrs. Jacques Heath (Lily May Peel)",female,35,1,0,113803,53.1,C123,S
  16. [6] - 5,0,3,"Allen, Mr. William Henry",male,35,0,0,373450,8.05,,S
  17. [7] - 6,0,3,"Moran, Mr. James",male,,0,0,330877,8.4583,,Q
  18. [8] - 7,0,1,"McCarthy, Mr. Timothy J",male,54,0,0,17463,51.8625,E46,S
  19. [9] - 8,0,3,"Palsson, Master. Gosta Leonard",male,2,3,1,349909,21.075,,S
  20. [10] - 9,1,3,"Johnson, Mrs. Oscar W (Elisabeth Vilhelmina Berg)",female,27,0,2,347742,11.1333,,S
  21. ...


List available commands

  1. $ python manage.py help
  2. # (Truncated Output)
  3. Type 'manage.py help <subcommand>' for help on a specific subcommand.
  4. Available subcommands:
  5. ...
  6. [cli]
  7. help_print_apps
  8. help_print_cfg
  9. help_print_models
  10. ...


List Registered Apps

  1. $ python manage.py help_print_apps
  2. # (Truncated Output)
  3. APP -> Webpack Loader
  4. APP -> Administration
  5. APP -> Authentication and Authorization
  6. ...


List Registered Models

  1. $ python manage.py help_print_models
  2. # (Truncated Output)
  3. APP -> Github
  4. APP -> Google
  5. APP -> Django_Quill
  6. APP -> Celery Results
  7. |--> django_celery_results.models.TaskResult
  8. |--> id: AutoField
  9. |--> task_id: CharField
  10. |--> periodic_task_name: CharField
  11. |--> task_name: CharField
  12. |--> task_args: TextField
  13. |--> task_kwargs: TextField
  14. |--> status: CharField
  15. |--> worker: CharField
  16. |--> content_type: CharField
  17. |--> content_encoding: CharField
  18. |--> result: TextField
  19. |--> date_created: DateTimeField
  20. |--> date_done: DateTimeField
  21. |--> traceback: TextField
  22. |--> meta: TextField
  23. |--> django_celery_results.models.ChordCounter
  24. |--> id: AutoField
  25. |--> group_id: CharField
  26. |--> sub_tasks: TextField
  27. |--> count: PositiveIntegerField
  28. |--> django_celery_results.models.GroupResult
  29. |--> id: AutoField
  30. |--> group_id: CharField
  31. |--> date_created: DateTimeField
  32. |--> date_done: DateTimeField
  33. |--> content_type: CharField
  34. |--> content_encoding: CharField
  35. |--> result: TextField


Celery (async tasks)

  • Make sure you have a Redis Server running: redis://localhost:6379
    • $ redis-cli and type ping
  • In the base directory inside tasks_scripts folder you need to write your scripts file.
  • Run the celery command from the CLI.
  1. $ export DJANGO_SETTINGS_MODULE="core.settings"
  2. $ celery -A core worker -l info -B

Executed Tasks, tasks_scripts DIR as defined in the EXEC Schedule

The output for each task can be found in the LOGS Directory.

Here is a LOG sample generated by a critical task that runs at every 5min:


Team

Core

Developers/Contractors


LICENSE

@EULA



Crafted and actively supported by AppSeed - support@appseed.us