├── .github
└── FUNDING.yml
├── .gitignore
├── Babel
├── 1-locale-data
│ ├── app.py
│ └── requirements.txt
├── 2-date-and-time
│ ├── app.py
│ └── requirements.txt
└── 3-number-formatting
│ ├── app.py
│ └── requirements.txt
├── Configparser
├── 1-basic-configparser-learn-to-wirte-you-own-config-file
│ ├── app.py
│ ├── config.ini
│ └── requirements.txt
├── 2-read-config.ini-file-and-use-the-data-from-the-config-file
│ ├── app.py
│ ├── config.ini
│ └── requirements.txt
└── 3-working-with-data-types-in-config-parser
│ ├── app.py
│ ├── config.ini
│ └── requirements.txt
├── Django
├── 1-setup-and-create-your-first-django-project
│ ├── helloworld
│ │ ├── db.sqlite3
│ │ ├── helloworld
│ │ │ ├── __init__.py
│ │ │ ├── asgi.py
│ │ │ ├── settings.py
│ │ │ ├── urls.py
│ │ │ └── wsgi.py
│ │ ├── manage.py
│ │ └── posts
│ │ │ ├── __init__.py
│ │ │ ├── admin.py
│ │ │ ├── apps.py
│ │ │ ├── migrations
│ │ │ └── __init__.py
│ │ │ ├── models.py
│ │ │ ├── tests.py
│ │ │ ├── urls.py
│ │ │ └── views.py
│ └── requirements.txt
├── 10-basic-working-with-data-model-in-django
│ ├── helloworld
│ │ ├── .env
│ │ ├── db.sqlite3
│ │ ├── helloworld
│ │ │ ├── __init__.py
│ │ │ ├── asgi.py
│ │ │ ├── settings.py
│ │ │ ├── urls.py
│ │ │ └── wsgi.py
│ │ ├── manage.py
│ │ └── posts
│ │ │ ├── __init__.py
│ │ │ ├── admin.py
│ │ │ ├── apps.py
│ │ │ ├── migrations
│ │ │ ├── 0001_initial.py
│ │ │ └── __init__.py
│ │ │ ├── models.py
│ │ │ ├── templates
│ │ │ ├── main.html
│ │ │ ├── post_detail.html
│ │ │ ├── post_list.html
│ │ │ ├── set-cookie-page.html
│ │ │ └── set-session-page.html
│ │ │ ├── tests.py
│ │ │ ├── urls.py
│ │ │ └── views.py
│ └── requirements.txt
├── 11-working-with-dynamic-url-and-link-building-in-django
│ ├── helloworld
│ │ ├── .env
│ │ ├── db.sqlite3
│ │ ├── helloworld
│ │ │ ├── __init__.py
│ │ │ ├── asgi.py
│ │ │ ├── settings.py
│ │ │ ├── urls.py
│ │ │ └── wsgi.py
│ │ ├── manage.py
│ │ └── posts
│ │ │ ├── __init__.py
│ │ │ ├── admin.py
│ │ │ ├── apps.py
│ │ │ ├── migrations
│ │ │ ├── 0001_initial.py
│ │ │ └── __init__.py
│ │ │ ├── models.py
│ │ │ ├── templates
│ │ │ ├── main.html
│ │ │ ├── post_detail.html
│ │ │ ├── post_list.html
│ │ │ ├── set-cookie-page.html
│ │ │ └── set-session-page.html
│ │ │ ├── tests.py
│ │ │ ├── urls.py
│ │ │ └── views.py
│ └── requirements.txt
├── 12-working-with-styling-static-content-and-image
│ ├── helloworld
│ │ ├── .env
│ │ ├── db.sqlite3
│ │ ├── helloworld
│ │ │ ├── __init__.py
│ │ │ ├── asgi.py
│ │ │ ├── settings.py
│ │ │ ├── urls.py
│ │ │ └── wsgi.py
│ │ ├── manage.py
│ │ └── posts
│ │ │ ├── __init__.py
│ │ │ ├── admin.py
│ │ │ ├── apps.py
│ │ │ ├── migrations
│ │ │ ├── 0001_initial.py
│ │ │ └── __init__.py
│ │ │ ├── models.py
│ │ │ ├── static
│ │ │ ├── css
│ │ │ │ └── main.css
│ │ │ └── image
│ │ │ │ └── cookie-lover.jpg
│ │ │ ├── templates
│ │ │ ├── main.html
│ │ │ ├── post_detail.html
│ │ │ ├── post_list.html
│ │ │ ├── set-cookie-page.html
│ │ │ └── set-session-page.html
│ │ │ ├── tests.py
│ │ │ ├── urls.py
│ │ │ └── views.py
│ └── requirements.txt
├── 13-how-to-use-vuejs-in-django-project
│ ├── djangoserver
│ │ ├── db.sqlite3
│ │ ├── djangoserver
│ │ │ ├── __init__.py
│ │ │ ├── asgi.py
│ │ │ ├── settings.py
│ │ │ ├── urls.py
│ │ │ └── wsgi.py
│ │ ├── manage.py
│ │ ├── posts
│ │ │ ├── __init__.py
│ │ │ ├── admin.py
│ │ │ ├── apps.py
│ │ │ ├── migrations
│ │ │ │ └── __init__.py
│ │ │ ├── models.py
│ │ │ ├── tests.py
│ │ │ ├── urls.py
│ │ │ └── views.py
│ │ └── requirements.txt
│ └── vueclient
│ │ ├── .browserslistrc
│ │ ├── README.md
│ │ ├── babel.config.js
│ │ ├── package-lock.json
│ │ ├── package.json
│ │ ├── public
│ │ ├── favicon.ico
│ │ ├── img
│ │ │ └── icons
│ │ │ │ ├── android-chrome-192x192.png
│ │ │ │ ├── android-chrome-512x512.png
│ │ │ │ ├── android-chrome-maskable-192x192.png
│ │ │ │ ├── android-chrome-maskable-512x512.png
│ │ │ │ ├── apple-touch-icon-120x120.png
│ │ │ │ ├── apple-touch-icon-152x152.png
│ │ │ │ ├── apple-touch-icon-180x180.png
│ │ │ │ ├── apple-touch-icon-60x60.png
│ │ │ │ ├── apple-touch-icon-76x76.png
│ │ │ │ ├── apple-touch-icon.png
│ │ │ │ ├── favicon-16x16.png
│ │ │ │ ├── favicon-32x32.png
│ │ │ │ ├── msapplication-icon-144x144.png
│ │ │ │ ├── mstile-150x150.png
│ │ │ │ └── safari-pinned-tab.svg
│ │ ├── index.html
│ │ └── robots.txt
│ │ └── src
│ │ ├── App.vue
│ │ ├── assets
│ │ └── logo.png
│ │ ├── components
│ │ └── HelloWorld.vue
│ │ ├── main.js
│ │ ├── registerServiceWorker.js
│ │ ├── router
│ │ └── index.js
│ │ ├── store
│ │ └── index.js
│ │ └── views
│ │ └── Home.vue
├── 2-url-mapping-with-regex-reular-expression-with-django
│ ├── helloworld
│ │ ├── db.sqlite3
│ │ ├── helloworld
│ │ │ ├── __init__.py
│ │ │ ├── asgi.py
│ │ │ ├── settings.py
│ │ │ ├── urls.py
│ │ │ └── wsgi.py
│ │ ├── manage.py
│ │ └── posts
│ │ │ ├── __init__.py
│ │ │ ├── admin.py
│ │ │ ├── apps.py
│ │ │ ├── migrations
│ │ │ └── __init__.py
│ │ │ ├── models.py
│ │ │ ├── tests.py
│ │ │ ├── urls.py
│ │ │ └── views.py
│ └── requirements.txt
├── 3-working-with-jinja-template-engine-with-django
│ ├── helloworld
│ │ ├── db.sqlite3
│ │ ├── helloworld
│ │ │ ├── __init__.py
│ │ │ ├── asgi.py
│ │ │ ├── settings.py
│ │ │ ├── urls.py
│ │ │ └── wsgi.py
│ │ ├── manage.py
│ │ └── posts
│ │ │ ├── __init__.py
│ │ │ ├── admin.py
│ │ │ ├── apps.py
│ │ │ ├── migrations
│ │ │ └── __init__.py
│ │ │ ├── models.py
│ │ │ ├── templates
│ │ │ ├── main.html
│ │ │ ├── post_detail.html
│ │ │ └── post_list.html
│ │ │ ├── tests.py
│ │ │ ├── urls.py
│ │ │ └── views.py
│ └── requirements.txt
├── 4-how-to-working-with-class-based-view-in-django
│ ├── helloworld
│ │ ├── db.sqlite3
│ │ ├── helloworld
│ │ │ ├── __init__.py
│ │ │ ├── asgi.py
│ │ │ ├── settings.py
│ │ │ ├── urls.py
│ │ │ └── wsgi.py
│ │ ├── manage.py
│ │ └── posts
│ │ │ ├── __init__.py
│ │ │ ├── admin.py
│ │ │ ├── apps.py
│ │ │ ├── migrations
│ │ │ └── __init__.py
│ │ │ ├── models.py
│ │ │ ├── templates
│ │ │ ├── main.html
│ │ │ ├── post_detail.html
│ │ │ └── post_list.html
│ │ │ ├── tests.py
│ │ │ ├── urls.py
│ │ │ └── views.py
│ └── requirements.txt
├── 5-working-with-cookies-in-django
│ ├── helloworld
│ │ ├── db.sqlite3
│ │ ├── helloworld
│ │ │ ├── __init__.py
│ │ │ ├── asgi.py
│ │ │ ├── settings.py
│ │ │ ├── urls.py
│ │ │ └── wsgi.py
│ │ ├── manage.py
│ │ └── posts
│ │ │ ├── __init__.py
│ │ │ ├── admin.py
│ │ │ ├── apps.py
│ │ │ ├── migrations
│ │ │ └── __init__.py
│ │ │ ├── models.py
│ │ │ ├── templates
│ │ │ ├── main.html
│ │ │ ├── post_detail.html
│ │ │ ├── post_list.html
│ │ │ └── set-cookie-page.html
│ │ │ ├── tests.py
│ │ │ ├── urls.py
│ │ │ └── views.py
│ └── requirements.txt
├── 6-working-with-sessions-in-django
│ ├── helloworld
│ │ ├── db.sqlite3
│ │ ├── helloworld
│ │ │ ├── __init__.py
│ │ │ ├── asgi.py
│ │ │ ├── settings.py
│ │ │ ├── urls.py
│ │ │ └── wsgi.py
│ │ ├── manage.py
│ │ └── posts
│ │ │ ├── __init__.py
│ │ │ ├── admin.py
│ │ │ ├── apps.py
│ │ │ ├── migrations
│ │ │ └── __init__.py
│ │ │ ├── models.py
│ │ │ ├── templates
│ │ │ ├── main.html
│ │ │ ├── post_detail.html
│ │ │ ├── post_list.html
│ │ │ ├── set-cookie-page.html
│ │ │ └── set-session-page.html
│ │ │ ├── tests.py
│ │ │ ├── urls.py
│ │ │ └── views.py
│ └── requirements.txt
├── 7-how-to-working-with-dotenv-in-django
│ ├── helloworld
│ │ ├── .env
│ │ ├── db.sqlite3
│ │ ├── helloworld
│ │ │ ├── __init__.py
│ │ │ ├── asgi.py
│ │ │ ├── settings.py
│ │ │ ├── urls.py
│ │ │ └── wsgi.py
│ │ ├── manage.py
│ │ └── posts
│ │ │ ├── __init__.py
│ │ │ ├── admin.py
│ │ │ ├── apps.py
│ │ │ ├── migrations
│ │ │ └── __init__.py
│ │ │ ├── models.py
│ │ │ ├── templates
│ │ │ ├── main.html
│ │ │ ├── post_detail.html
│ │ │ ├── post_list.html
│ │ │ ├── set-cookie-page.html
│ │ │ └── set-session-page.html
│ │ │ ├── tests.py
│ │ │ ├── urls.py
│ │ │ └── views.py
│ └── requirements.txt
├── 8-create-model-for-your-django-application
│ ├── helloworld
│ │ ├── .env
│ │ ├── db.sqlite3
│ │ ├── helloworld
│ │ │ ├── __init__.py
│ │ │ ├── asgi.py
│ │ │ ├── settings.py
│ │ │ ├── urls.py
│ │ │ └── wsgi.py
│ │ ├── manage.py
│ │ └── posts
│ │ │ ├── __init__.py
│ │ │ ├── admin.py
│ │ │ ├── apps.py
│ │ │ ├── migrations
│ │ │ ├── 0001_initial.py
│ │ │ └── __init__.py
│ │ │ ├── models.py
│ │ │ ├── templates
│ │ │ ├── main.html
│ │ │ ├── post_detail.html
│ │ │ ├── post_list.html
│ │ │ ├── set-cookie-page.html
│ │ │ └── set-session-page.html
│ │ │ ├── tests.py
│ │ │ ├── urls.py
│ │ │ └── views.py
│ └── requirements.txt
└── 9-working-with-basic-admin-panel-with-model-in-django
│ ├── helloworld
│ ├── .env
│ ├── db.sqlite3
│ ├── helloworld
│ │ ├── __init__.py
│ │ ├── asgi.py
│ │ ├── settings.py
│ │ ├── urls.py
│ │ └── wsgi.py
│ ├── manage.py
│ └── posts
│ │ ├── __init__.py
│ │ ├── admin.py
│ │ ├── apps.py
│ │ ├── migrations
│ │ ├── 0001_initial.py
│ │ └── __init__.py
│ │ ├── models.py
│ │ ├── templates
│ │ ├── main.html
│ │ ├── post_detail.html
│ │ ├── post_list.html
│ │ ├── set-cookie-page.html
│ │ └── set-session-page.html
│ │ ├── tests.py
│ │ ├── urls.py
│ │ └── views.py
│ └── requirements.txt
├── Falcon
├── part-1-and-part-2-basic-rest-api
│ ├── README.md
│ └── app.py
├── part-3-rest-api-request-methods
│ ├── README.md
│ └── app.py
├── part-4-rest-api-json-input-validate-from-client
│ ├── README.md
│ └── app.py
├── part-5-how-to-use-params
│ └── app.py
└── part-6-how-to-use-body-json
│ └── app.py
├── Flask
├── 10-working-with-http-cross-origin-to-allow-external-request
│ ├── app.py
│ └── requirements.txt
├── 11-basic-web-application-with-flask-and-jinja
│ ├── app.py
│ └── requirements.txt
├── 12-working-with-middleware-general
│ ├── app.py
│ ├── middleware.py
│ └── requirements.txt
├── 13-working-with-middleware-for-specific-route
│ ├── app.py
│ ├── middleware.py
│ └── requirements.txt
├── 14-use-class-@staticmethod-function-to-manually-routes
│ ├── app.py
│ ├── helloWorld.py
│ └── requirements.txt
├── 7-print-to-console-with-flask-logger
│ ├── app.py
│ └── requirements.txt
├── 8-email-logging-errors-to-admin
│ ├── app.py
│ └── requirements.txt
├── 9-change-http-status-code-on-the-fly
│ ├── app.py
│ └── requirements.txt
└── how-to-use-prometheus-flask-exporter
│ ├── Dockerfile
│ ├── app.py
│ ├── deployment.yaml
│ └── requirements.txt
├── Jinja
├── 1-basic-jinja-application
│ ├── app.py
│ └── requirements.txt
├── 2-use-externel-html-files-with-jinja
│ ├── requirements.txt
│ ├── use-jinja-environment.py
│ └── use-open-command.py
├── 3-extends-html-files-to-work-with-multi-html-files
│ ├── app.py
│ ├── requirements.txt
│ └── template
│ │ ├── content.html
│ │ └── layout.html
├── 4-working-with-loops
│ ├── loop-list-with-dict.py
│ ├── loop-list-with-string.py
│ ├── requirements.txt
│ └── template
│ │ ├── layout.html
│ │ └── layout2.html
└── 5-working-with-conditional
│ ├── app.py
│ ├── requirements.txt
│ └── template
│ └── layout.html
├── Kafka
├── README.md
├── docker-compose.yml
├── kafka_connect_config
│ └── connect-distributed.properties
├── kui
│ └── config.yml
└── sample
│ ├── booking.avsc
│ ├── consuming-avro.py
│ ├── consuming-glue-schema.py
│ ├── consuming.py
│ ├── producer-avro.py
│ ├── producer-glue-schema.py
│ ├── producer.py
│ ├── requirements.txt
│ └── settings.py
├── LocalStack
└── how-you-can-test-your-aws-cloud-infrastructure-locally-with-pytest-and-localstack-inside-a-docker-containers
│ ├── .deployment
│ └── unittest
│ │ └── Dockerfile
│ ├── app.py
│ ├── cdk.json
│ ├── requirements.txt
│ ├── run-test.sh
│ ├── stacks
│ ├── lambda_assets
│ │ └── test_fn
│ │ │ └── lambda_handler.py
│ ├── lambda_layers
│ │ └── test_layer
│ │ │ └── python
│ │ │ └── lib
│ │ │ └── python3.9
│ │ │ └── site-packages
│ │ │ └── helloWorld
│ │ │ └── __init__.py
│ └── testStack.py
│ └── tests
│ ├── .env-test
│ ├── conftest.py
│ ├── functional
│ ├── test_lambda.py
│ └── test_s3.py
│ ├── pytest.ini
│ └── utils
│ └── aws
│ ├── lambda_.py
│ └── s3.py
├── Milvus
├── enable-and-create-auth-user-in-milvus
│ ├── sample-code
│ │ ├── .env
│ │ ├── create-user.py
│ │ ├── delete-user.py
│ │ ├── list-user.py
│ │ ├── requirements.txt
│ │ └── reset-password.py
│ ├── update-milvus.sh
│ └── values.yaml
├── run-milvus-on-aws-eks-in-cluster-mode
│ ├── deploy-milvus.sh
│ ├── eks-cluster.yml
│ └── sample-code
│ │ ├── .env
│ │ ├── create-collection.py
│ │ ├── insert-data.py
│ │ ├── requirements.txt
│ │ └── search.py
└── scale-out-milvus-with-multi-query-nodes
│ ├── sample-code
│ ├── .env
│ ├── create-collection.py
│ └── requirements.txt
│ └── scale-out.sh
├── Poetry
└── my-first-project
│ ├── README.md
│ ├── poetry.lock
│ ├── pyproject.toml
│ ├── src
│ └── model
│ │ └── __init__.py
│ └── tests
│ └── test_my_func.py
├── README.md
├── Unittest
├── 1-basic-unittest-in-python
│ ├── Library
│ │ ├── Company.py
│ │ └── __init__.py
│ └── Unittest
│ │ └── TestLibraryCompany.py
├── 2-how-to-use-setUp-and-tearDown-in-unittest
│ ├── code-finished
│ │ ├── Unittest
│ │ │ └── TestLibraryPerson.py
│ │ └── library
│ │ │ ├── __init__.py
│ │ │ └── person.py
│ └── code-start
│ │ ├── Unittest
│ │ └── TestLibraryPerson.py
│ │ └── library
│ │ ├── __init__.py
│ │ └── person.py
├── 3-create-faster-unittest-with-functions
│ ├── code-finished
│ │ ├── Unittest
│ │ │ └── TestLibraryPerson.py
│ │ └── library
│ │ │ ├── __init__.py
│ │ │ └── person.py
│ └── code-start
│ │ ├── Unittest
│ │ └── TestLibraryPerson.py
│ │ └── library
│ │ ├── __init__.py
│ │ └── person.py
├── 4-how-to-success-passed-your-test-cases
│ ├── code-finished
│ │ ├── Unittest
│ │ │ └── TestLibraryPerson.py
│ │ └── library
│ │ │ ├── __init__.py
│ │ │ └── person.py
│ └── code-start
│ │ ├── Unittest
│ │ └── TestLibraryPerson.py
│ │ └── library
│ │ ├── __init__.py
│ │ └── person.py
├── 5-use-custom-assert-in-your-unittest-test-cases
│ ├── code-finished
│ │ ├── Unittest
│ │ │ └── TestLibraryPerson.py
│ │ └── library
│ │ │ ├── __init__.py
│ │ │ ├── alcohol.py
│ │ │ └── person.py
│ └── code-start
│ │ ├── Unittest
│ │ └── TestLibraryPerson.py
│ │ └── library
│ │ ├── __init__.py
│ │ └── person.py
└── 6-how-to-catch-a-raise-error
│ ├── code-finished
│ ├── Unittest
│ │ └── TestLibraryPerson.py
│ └── library
│ │ ├── __init__.py
│ │ ├── alcohol.py
│ │ └── person.py
│ └── code-start
│ ├── Unittest
│ └── TestLibraryPerson.py
│ └── library
│ ├── __init__.py
│ ├── alcohol.py
│ └── person.py
├── aws
├── AWS-CDK
│ ├── APIGateway
│ │ └── using-lambda-authorizers-on-routes
│ │ │ ├── app.py
│ │ │ ├── awsStack
│ │ │ ├── apiGatewayStack.py
│ │ │ ├── awsRootStack.py
│ │ │ └── lambdaStack.py
│ │ │ ├── cdk.json
│ │ │ ├── lambdaAssets
│ │ │ └── apiGateway
│ │ │ │ ├── getUser.py
│ │ │ │ └── userAuthorizer.py
│ │ │ └── requirements.txt
│ ├── CloudWatch
│ │ └── cost-monitor-lambda-functions
│ │ │ ├── app.py
│ │ │ ├── cdk.json
│ │ │ ├── infrastructure
│ │ │ ├── lambdaStack.py
│ │ │ └── prototypeCostStack.py
│ │ │ ├── lambda
│ │ │ ├── monitorMetrics
│ │ │ │ ├── index.py
│ │ │ │ └── resources
│ │ │ │ │ ├── __init__.py
│ │ │ │ │ └── lambda_.py
│ │ │ └── testLambda
│ │ │ │ └── index.py
│ │ │ └── requirements.txt
│ ├── DynamoDB
│ │ └── create-a-dynamodb-and-grant-access-to-lambda-functions-and-attach-it-to-an-api-gateway
│ │ │ ├── app.py
│ │ │ ├── awsStack
│ │ │ ├── apiGatewayStack.py
│ │ │ ├── awsRootStack.py
│ │ │ ├── databaseStack.py
│ │ │ ├── iamPolicyStack.py
│ │ │ └── lambdaStack.py
│ │ │ ├── cdk.json
│ │ │ ├── lambdaAssets
│ │ │ └── apiGateway
│ │ │ │ ├── getTableItem.py
│ │ │ │ └── insertTableItem.py
│ │ │ └── requirements.txt
│ ├── ECS
│ │ ├── ecr-auto-rollout-new-image
│ │ │ ├── app.py
│ │ │ ├── assets
│ │ │ │ ├── container
│ │ │ │ │ └── flask-app
│ │ │ │ │ │ ├── Dockerfile
│ │ │ │ │ │ └── app.py
│ │ │ │ └── lambda
│ │ │ │ │ └── deployEvent
│ │ │ │ │ └── index.py
│ │ │ ├── cdk.json
│ │ │ ├── infrastructure
│ │ │ │ ├── deployStack.py
│ │ │ │ ├── ecsAutoDeployPrototypeStack.py
│ │ │ │ ├── ecsStack.py
│ │ │ │ └── networkStack.py
│ │ │ ├── requirements.txt
│ │ │ └── setup.cfg
│ │ └── share-efs-mount-with-multi-containers-in-a-services
│ │ │ ├── app.py
│ │ │ ├── cdk.json
│ │ │ ├── docker
│ │ │ ├── Dockerfile
│ │ │ ├── app.py
│ │ │ └── requirements.txt
│ │ │ ├── infrastructure
│ │ │ ├── ecsStack.py
│ │ │ ├── efsFileSystemStack.py
│ │ │ ├── networkStack.py
│ │ │ └── sharedEFSMountInECSClusterPrototypeStack.py
│ │ │ ├── requirements.txt
│ │ │ └── setup.cfg
│ ├── EKS
│ │ └── setup-readonly-user-role-in-aws-eks
│ │ │ ├── .gitignore
│ │ │ ├── README.md
│ │ │ ├── app.py
│ │ │ ├── cdk.json
│ │ │ ├── infrastructure
│ │ │ ├── kubernetesStack.py
│ │ │ └── networkStack.py
│ │ │ ├── requirements.txt
│ │ │ └── setup.cfg
│ ├── ELB
│ │ ├── el-with-mutli-domain-support
│ │ │ ├── app.py
│ │ │ ├── assets
│ │ │ │ └── container
│ │ │ │ │ └── flask-app
│ │ │ │ │ ├── Dockerfile
│ │ │ │ │ └── app.py
│ │ │ ├── cdk.json
│ │ │ ├── infrastructure
│ │ │ │ ├── ecsStack.py
│ │ │ │ ├── lbStack.py
│ │ │ │ └── networkStack.py
│ │ │ ├── requirements.txt
│ │ │ └── setup.cfg
│ │ └── elb-with-ssl-support
│ │ │ ├── app.py
│ │ │ ├── cdk.json
│ │ │ ├── infrastructure
│ │ │ ├── lbStack.py
│ │ │ └── networkStack.py
│ │ │ ├── requirements.txt
│ │ │ └── setup.cfg
│ ├── IAM
│ │ └── github-action-use-oidc-provider
│ │ │ ├── .github
│ │ │ └── workflows
│ │ │ │ └── deploy.yml
│ │ │ ├── app.py
│ │ │ ├── cdk.json
│ │ │ ├── infrastructure
│ │ │ └── prototypeOIDCProvider.py
│ │ │ └── requirements.txt
│ ├── Lambda
│ │ ├── disable-lambda-on-to-many-ivocations
│ │ │ ├── app.py
│ │ │ ├── assets
│ │ │ │ └── lambda
│ │ │ │ │ ├── disableHeavyLambda
│ │ │ │ │ └── index.py
│ │ │ │ │ └── testLambda
│ │ │ │ │ └── index.py
│ │ │ ├── cdk.json
│ │ │ ├── infrastructure
│ │ │ │ ├── lambdaStack.py
│ │ │ │ └── prototypeDisableLambdaStack.py
│ │ │ └── requirements.txt
│ │ └── mount-efs-access-point-for-lambda
│ │ │ ├── app.py
│ │ │ ├── assets
│ │ │ └── lambda
│ │ │ │ └── testLambda
│ │ │ │ └── index.py
│ │ │ ├── cdk.json
│ │ │ ├── infrastructure
│ │ │ ├── networkStack.py
│ │ │ ├── prototypeStack.py
│ │ │ └── s3Stack.py
│ │ │ └── requirements.txt
│ └── VPC
│ │ ├── create-vpc-endpoint-interface-aws-privatelink
│ │ ├── app.py
│ │ ├── awsStack
│ │ │ ├── awsRootStack.py
│ │ │ ├── lambdaStack.py
│ │ │ └── networkStack.py
│ │ ├── cdk.json
│ │ ├── lambdaAssets
│ │ │ └── helloWorld.py
│ │ └── requirements.txt
│ │ ├── vpc-cross-account-peering
│ │ ├── app.py
│ │ ├── cdk.json
│ │ ├── infrastructure
│ │ │ ├── prototypeVPCPeerOneWithTwo.py
│ │ │ ├── prototypeVPCPeeringAccountOneStack.py
│ │ │ └── prototypeVPCPeeringAccountTwoStack.py
│ │ ├── requirements.txt
│ │ └── settings.py
│ │ └── vpc-peering
│ │ ├── app.py
│ │ ├── cdk.json
│ │ ├── infrastructure
│ │ ├── loadbalancePublicStack.py
│ │ ├── networkPeeringStack.py
│ │ ├── networkStack.py
│ │ └── prototypeAlbStack.py
│ │ ├── public_image
│ │ ├── Dockerfile
│ │ └── app.py
│ │ └── requirements.txt
├── Cognito
│ ├── 2-create user account and verification with confirmation-code
│ │ ├── .env-sample
│ │ ├── confirm_sign_up.py
│ │ ├── requirements.txt
│ │ ├── resend_confirmation_code.py
│ │ └── sign_up.py
│ ├── 3-login-with-user-and-get-user-data-response-from-access-token
│ │ ├── .env-sample
│ │ ├── get_user.py
│ │ ├── initiate_auth.py
│ │ └── requirements.txt
│ └── 4-reset-user-password-and-change-the-password
│ │ ├── .env-sample
│ │ ├── change_password.py
│ │ ├── confirm_forgot_password.py
│ │ ├── forgot_password.py
│ │ └── requirements.txt
├── DynamoDB
│ └── working-with-dynamodb-stream-with-lambda
│ │ ├── init.sh
│ │ ├── lambda_assets
│ │ └── dynamoDBStream
│ │ │ └── lambda_handler.py
│ │ ├── policy.json
│ │ └── role.json
└── Lambda
│ └── how-to-work-with-lambda-layers
│ ├── .github
│ └── workflows
│ │ └── layer-pymongo.yml
│ └── pymongo
│ └── requirements.txt
└── mongoengine
├── 1-how-to-connect-to-mongo-database
├── alias-connect.py
├── auth-connect.py
├── disconnect.py
├── requirements.txt
├── simple-connect.py
└── uri-connect.py
├── 2-insert-new-document-to-mongo
├── app.py
├── orm
│ └── user.py
└── requirements.txt
├── 3-update-document-to-mongo
├── app.py
├── orm
│ └── user.py
└── requirements.txt
├── 4-how-to-working-with-index
├── app.py
├── odm
│ └── posts.py
└── requirements.txt
├── 5-how-to-use-custom-field-name-for-collection-and-document-fields
├── app.py
├── odm
│ └── posts.py
└── requirements.txt
├── 6-working-with-embedded-documents-in-mongoengine
├── app.py
├── odm
│ └── posts.py
└── requirements.txt
├── 7-create-document-with-embedded-document-in-mongoengine
├── app.py
├── odm
│ └── posts.py
└── requirements.txt
├── 8-how-to-update-document-with-embedded-documents
├── app.py
├── odm
│ └── posts.py
└── requirements.txt
└── 9-how-to-use-auto-increment-as-primary-in-mongoengine
├── app.py
├── lib
└── settings.py
├── odm
├── posts.py
└── users.py
└── requirements.txt
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | patreon: parisnakitakejser
4 | github: [parisnakitakejser]
5 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.pyc
2 | .dccache
3 | venv
4 | cdk.out
5 | .DS_Store
6 | aws/AWS-CDK/Neptune/create-neptune-cluster-with-bastion-host/.env
7 | .python-version
8 |
--------------------------------------------------------------------------------
/Babel/1-locale-data/app.py:
--------------------------------------------------------------------------------
1 | from babel import Locale
2 |
3 | print('# Output in english:')
4 | locale = Locale('en', 'US')
5 | print(locale.territories['US'])
6 |
7 | print('# Output in danish:')
8 | locale = Locale('da', 'DK')
9 | print(locale.territories['US'])
10 |
11 | print('# output lang and country:')
12 | locale = locale.parse('de_DE')
13 | print(locale.get_display_name('en_US'))
14 |
15 | locale = locale.parse('da_DK')
16 | print(locale.get_display_name('en_US'))
17 |
18 | print('# Output calender days')
19 | locale = Locale('en')
20 | month_names = locale.months['format']['wide'].items()
21 | print(list(month_names))
22 |
23 | locale = Locale('da')
24 | month_names = locale.months['format']['wide'].items()
25 | print(list(month_names))
--------------------------------------------------------------------------------
/Babel/1-locale-data/requirements.txt:
--------------------------------------------------------------------------------
1 | Babel==2.8.0
2 | pytz==2019.3
3 |
--------------------------------------------------------------------------------
/Babel/2-date-and-time/requirements.txt:
--------------------------------------------------------------------------------
1 | Babel==2.8.0
2 | pytz==2019.3
3 |
--------------------------------------------------------------------------------
/Babel/3-number-formatting/app.py:
--------------------------------------------------------------------------------
1 | from babel.numbers import format_decimal, format_percent
2 |
3 | number = 1234.5678
4 |
5 | print('# Locale number format')
6 | print('USA', format_decimal(number=number, locale='en_US'))
7 | print('Denmark', format_decimal(number=number, locale='da_DK'))
8 |
9 | print('# Customer number format')
10 | print('change to 2 decimals', format_decimal(number=number, format='#,##0.##', locale='da'))
11 | print('strip to clean int', format_decimal(number=number, format='#', locale='da'))
12 | print('strip to clean float', format_decimal(number=number, format='#.##', locale='en'))
--------------------------------------------------------------------------------
/Babel/3-number-formatting/requirements.txt:
--------------------------------------------------------------------------------
1 | Babel==2.8.0
2 | pytz==2019.3
3 |
--------------------------------------------------------------------------------
/Configparser/1-basic-configparser-learn-to-wirte-you-own-config-file/app.py:
--------------------------------------------------------------------------------
1 | from configparser import ConfigParser
2 |
3 | config = ConfigParser()
4 |
5 | config['DEFAULT'] = {
6 | 'title': 'Hello world',
7 | 'compression': 'yes',
8 | 'compression_level': '9'
9 | }
10 |
11 | config['database'] = {}
12 | database = config['database']
13 | database['host'] = '127.0.0.1'
14 | database['user'] = 'username'
15 | database['pass'] = 'password'
16 | database['keep-alive'] = 'no'
17 |
18 | with open('config.ini', 'w') as configfile:
19 | config.write(configfile)
--------------------------------------------------------------------------------
/Configparser/1-basic-configparser-learn-to-wirte-you-own-config-file/config.ini:
--------------------------------------------------------------------------------
1 | [DEFAULT]
2 | title = Hello world
3 | compression = yes
4 | compression_level = 9
5 |
6 | [database]
7 | host = 127.0.0.1
8 | user = username
9 | pass = password
10 | keep-alive = no
11 |
12 |
--------------------------------------------------------------------------------
/Configparser/1-basic-configparser-learn-to-wirte-you-own-config-file/requirements.txt:
--------------------------------------------------------------------------------
1 | configparser==4.0.2
2 |
--------------------------------------------------------------------------------
/Configparser/2-read-config.ini-file-and-use-the-data-from-the-config-file/app.py:
--------------------------------------------------------------------------------
1 | from configparser import ConfigParser
2 | config = ConfigParser()
3 | print(config.sections())
4 |
5 | config.read('config.ini')
6 | print(config.sections())
7 |
8 | print(config['DEFAULT']['title'])
9 | print(config['database']['host'])
--------------------------------------------------------------------------------
/Configparser/2-read-config.ini-file-and-use-the-data-from-the-config-file/config.ini:
--------------------------------------------------------------------------------
1 | [DEFAULT]
2 | title = Hello world
3 | compression = yes
4 | compression_level = 9
5 |
6 | [database]
7 | host = 127.0.0.1
8 | user = username
9 | pass = password
10 | keep-alive = no
11 |
12 |
--------------------------------------------------------------------------------
/Configparser/2-read-config.ini-file-and-use-the-data-from-the-config-file/requirements.txt:
--------------------------------------------------------------------------------
1 | configparser==4.0.2
2 |
--------------------------------------------------------------------------------
/Configparser/3-working-with-data-types-in-config-parser/app.py:
--------------------------------------------------------------------------------
1 | from configparser import ConfigParser
2 | config = ConfigParser()
3 | config.read('config.ini')
4 |
5 | title = config.get('DEFAULT', 'title')
6 | print('title', type(title), title)
7 |
8 | username = config.get('database', 'user')
9 | port = config.getint('database', 'port')
10 | keep_alive = config.getboolean('database', 'keep-alive')
11 | timeout = config.getint('database', 'timeout', fallback=60)
12 |
13 | print('user', type(username), username)
14 | print('port', type(port), port)
15 | print('keep_alive', type(keep_alive), keep_alive)
16 |
17 | print('timeout', type(timeout), timeout)
--------------------------------------------------------------------------------
/Configparser/3-working-with-data-types-in-config-parser/config.ini:
--------------------------------------------------------------------------------
1 | [DEFAULT]
2 | title = Hello world
3 | compression = yes
4 | compression_level = 9
5 |
6 | [database]
7 | host = 127.0.0.1
8 | port = 9000
9 | user = test-username
10 | pass = password
11 | keep-alive = no
12 | timeout = 300
13 |
14 |
--------------------------------------------------------------------------------
/Configparser/3-working-with-data-types-in-config-parser/requirements.txt:
--------------------------------------------------------------------------------
1 | configparser==4.0.2
2 |
--------------------------------------------------------------------------------
/Django/1-setup-and-create-your-first-django-project/helloworld/db.sqlite3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/1-setup-and-create-your-first-django-project/helloworld/db.sqlite3
--------------------------------------------------------------------------------
/Django/1-setup-and-create-your-first-django-project/helloworld/helloworld/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/1-setup-and-create-your-first-django-project/helloworld/helloworld/__init__.py
--------------------------------------------------------------------------------
/Django/1-setup-and-create-your-first-django-project/helloworld/helloworld/asgi.py:
--------------------------------------------------------------------------------
1 | """
2 | ASGI config for helloworld project.
3 |
4 | It exposes the ASGI callable as a module-level variable named ``application``.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/
8 | """
9 |
10 | import os
11 |
12 | from django.core.asgi import get_asgi_application
13 |
14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'helloworld.settings')
15 |
16 | application = get_asgi_application()
17 |
--------------------------------------------------------------------------------
/Django/1-setup-and-create-your-first-django-project/helloworld/helloworld/wsgi.py:
--------------------------------------------------------------------------------
1 | """
2 | WSGI config for helloworld project.
3 |
4 | It exposes the WSGI callable as a module-level variable named ``application``.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/
8 | """
9 |
10 | import os
11 |
12 | from django.core.wsgi import get_wsgi_application
13 |
14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'helloworld.settings')
15 |
16 | application = get_wsgi_application()
17 |
--------------------------------------------------------------------------------
/Django/1-setup-and-create-your-first-django-project/helloworld/manage.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | """Django's command-line utility for administrative tasks."""
3 | import os
4 | import sys
5 |
6 |
7 | def main():
8 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'helloworld.settings')
9 | try:
10 | from django.core.management import execute_from_command_line
11 | except ImportError as exc:
12 | raise ImportError(
13 | "Couldn't import Django. Are you sure it's installed and "
14 | "available on your PYTHONPATH environment variable? Did you "
15 | "forget to activate a virtual environment?"
16 | ) from exc
17 | execute_from_command_line(sys.argv)
18 |
19 |
20 | if __name__ == '__main__':
21 | main()
22 |
--------------------------------------------------------------------------------
/Django/1-setup-and-create-your-first-django-project/helloworld/posts/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/1-setup-and-create-your-first-django-project/helloworld/posts/__init__.py
--------------------------------------------------------------------------------
/Django/1-setup-and-create-your-first-django-project/helloworld/posts/admin.py:
--------------------------------------------------------------------------------
1 | from django.contrib import admin
2 |
3 | # Register your models here.
4 |
--------------------------------------------------------------------------------
/Django/1-setup-and-create-your-first-django-project/helloworld/posts/apps.py:
--------------------------------------------------------------------------------
1 | from django.apps import AppConfig
2 |
3 |
4 | class PostsConfig(AppConfig):
5 | name = 'posts'
6 |
--------------------------------------------------------------------------------
/Django/1-setup-and-create-your-first-django-project/helloworld/posts/migrations/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/1-setup-and-create-your-first-django-project/helloworld/posts/migrations/__init__.py
--------------------------------------------------------------------------------
/Django/1-setup-and-create-your-first-django-project/helloworld/posts/models.py:
--------------------------------------------------------------------------------
1 | from django.db import models
2 |
3 | # Create your models here.
4 |
--------------------------------------------------------------------------------
/Django/1-setup-and-create-your-first-django-project/helloworld/posts/tests.py:
--------------------------------------------------------------------------------
1 | from django.test import TestCase
2 |
3 | # Create your tests here.
4 |
--------------------------------------------------------------------------------
/Django/1-setup-and-create-your-first-django-project/helloworld/posts/urls.py:
--------------------------------------------------------------------------------
1 | from django.urls import path
2 | from . import views
3 |
4 | urlpatterns = [
5 | path('', views.index, name='index')
6 | ]
--------------------------------------------------------------------------------
/Django/1-setup-and-create-your-first-django-project/helloworld/posts/views.py:
--------------------------------------------------------------------------------
1 | from django.shortcuts import render
2 |
3 | # Create your views here.
4 | from django.http import HttpResponse
5 |
6 |
7 | def index(request):
8 | return HttpResponse('Hello world - our first index pages')
9 |
--------------------------------------------------------------------------------
/Django/1-setup-and-create-your-first-django-project/requirements.txt:
--------------------------------------------------------------------------------
1 | asgiref==3.2.10
2 | Django==3.0.8
3 | pytz==2020.1
4 | sqlparse==0.3.1
5 |
--------------------------------------------------------------------------------
/Django/10-basic-working-with-data-model-in-django/helloworld/.env:
--------------------------------------------------------------------------------
1 | SECRET_KEY=16cczc3*@+8t#g*4_da9+zuj)ql_5^a4-ho0r9aj!&r$wj=-g6
2 | MEMCACHE_HOST=127.0.0.1.8008
--------------------------------------------------------------------------------
/Django/10-basic-working-with-data-model-in-django/helloworld/db.sqlite3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/10-basic-working-with-data-model-in-django/helloworld/db.sqlite3
--------------------------------------------------------------------------------
/Django/10-basic-working-with-data-model-in-django/helloworld/helloworld/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/10-basic-working-with-data-model-in-django/helloworld/helloworld/__init__.py
--------------------------------------------------------------------------------
/Django/10-basic-working-with-data-model-in-django/helloworld/helloworld/asgi.py:
--------------------------------------------------------------------------------
1 | """
2 | ASGI config for helloworld project.
3 |
4 | It exposes the ASGI callable as a module-level variable named ``application``.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/
8 | """
9 |
10 | import os
11 |
12 | from django.core.asgi import get_asgi_application
13 |
14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'helloworld.settings')
15 |
16 | application = get_asgi_application()
17 |
--------------------------------------------------------------------------------
/Django/10-basic-working-with-data-model-in-django/helloworld/helloworld/wsgi.py:
--------------------------------------------------------------------------------
1 | """
2 | WSGI config for helloworld project.
3 |
4 | It exposes the WSGI callable as a module-level variable named ``application``.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/
8 | """
9 |
10 | import os
11 |
12 | from django.core.wsgi import get_wsgi_application
13 |
14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'helloworld.settings')
15 |
16 | application = get_wsgi_application()
17 |
--------------------------------------------------------------------------------
/Django/10-basic-working-with-data-model-in-django/helloworld/manage.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | """Django's command-line utility for administrative tasks."""
3 | import os
4 | import sys
5 | import dotenv
6 |
7 |
8 | def main():
9 | dotenv.read_dotenv()
10 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'helloworld.settings')
11 | try:
12 | from django.core.management import execute_from_command_line
13 | except ImportError as exc:
14 | raise ImportError(
15 | "Couldn't import Django. Are you sure it's installed and "
16 | "available on your PYTHONPATH environment variable? Did you "
17 | "forget to activate a virtual environment?"
18 | ) from exc
19 | execute_from_command_line(sys.argv)
20 |
21 |
22 | if __name__ == '__main__':
23 | main()
24 |
--------------------------------------------------------------------------------
/Django/10-basic-working-with-data-model-in-django/helloworld/posts/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/10-basic-working-with-data-model-in-django/helloworld/posts/__init__.py
--------------------------------------------------------------------------------
/Django/10-basic-working-with-data-model-in-django/helloworld/posts/admin.py:
--------------------------------------------------------------------------------
1 | from django.contrib import admin
2 |
3 | # Register your models here.
4 | from .models import Post, Category
5 |
6 | admin.site.register(Post)
7 | admin.site.register(Category)
--------------------------------------------------------------------------------
/Django/10-basic-working-with-data-model-in-django/helloworld/posts/apps.py:
--------------------------------------------------------------------------------
1 | from django.apps import AppConfig
2 |
3 |
4 | class PostsConfig(AppConfig):
5 | name = 'posts'
6 |
--------------------------------------------------------------------------------
/Django/10-basic-working-with-data-model-in-django/helloworld/posts/migrations/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/10-basic-working-with-data-model-in-django/helloworld/posts/migrations/__init__.py
--------------------------------------------------------------------------------
/Django/10-basic-working-with-data-model-in-django/helloworld/posts/models.py:
--------------------------------------------------------------------------------
1 | from django.db import models
2 |
3 |
4 | class Category(models.Model):
5 | title = models.CharField(max_length=100)
6 |
7 | def __str__(self):
8 | return f'{self.title}'
9 |
10 |
11 | class Post(models.Model):
12 | title = models.CharField(max_length=200)
13 | content = models.TextField()
14 | category = models.ForeignKey(Category, on_delete=models.CASCADE)
15 |
16 | created_at = models.DateField()
17 |
18 | def __str__(self):
19 | return f'{self.title} at {self.created_at}'
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Django/10-basic-working-with-data-model-in-django/helloworld/posts/templates/main.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | My post jinja temaplte for Django!
6 |
7 |
8 |
9 | {% block content %}
10 |
11 | Content temaplte block missing, pls fill out
12 |
13 | {% endblock %}
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Django/10-basic-working-with-data-model-in-django/helloworld/posts/templates/post_detail.html:
--------------------------------------------------------------------------------
1 | {% extends "main.html" %}
2 |
3 | {% block content %}
4 | {{ post.title }}
5 |
6 | Created at {{ post.created_at }} in category: {{ post.category }}
7 |
8 |
9 |
10 | {{ post.content }}
11 |
12 |
13 |
14 | <- Go back
15 |
16 | {% endblock %}
--------------------------------------------------------------------------------
/Django/10-basic-working-with-data-model-in-django/helloworld/posts/templates/post_list.html:
--------------------------------------------------------------------------------
1 | {% extends "main.html" %}
2 |
3 | {% block content %}
4 |
8 |
9 |
10 |
11 | Session data
12 | {{ session }}
13 |
14 | {{ title }}
15 | {{ description }}
16 |
17 |
22 | {% endblock %}
--------------------------------------------------------------------------------
/Django/10-basic-working-with-data-model-in-django/helloworld/posts/templates/set-cookie-page.html:
--------------------------------------------------------------------------------
1 | {% extends "main.html" %}
2 |
3 | {% block content %}
4 | Set cookie pages!
5 | You have set the cookie now
6 |
7 | <- Go back
8 | {% endblock %}
--------------------------------------------------------------------------------
/Django/10-basic-working-with-data-model-in-django/helloworld/posts/templates/set-session-page.html:
--------------------------------------------------------------------------------
1 | {% extends "main.html" %}
2 |
3 | {% block content %}
4 | Set session page
5 | Session now set!
6 |
7 | <- Go back
8 | {% endblock %}
--------------------------------------------------------------------------------
/Django/10-basic-working-with-data-model-in-django/helloworld/posts/tests.py:
--------------------------------------------------------------------------------
1 | from django.test import TestCase
2 |
3 | # Create your tests here.
4 |
--------------------------------------------------------------------------------
/Django/10-basic-working-with-data-model-in-django/helloworld/posts/urls.py:
--------------------------------------------------------------------------------
1 | from django.urls import path, re_path
2 | from . import views
3 | from .views import PostDetail, PostList, PostSetSessionPage
4 |
5 | urlpatterns = [
6 | path('', PostList.as_view(), name='index'),
7 | path('set-cookie-demo', views.set_cookie_demo_page, name='cookie-page'),
8 | path('set-session-demo', PostSetSessionPage.as_view(), name='session-page'),
9 | re_path(r'^(?P\d+)', PostDetail.as_view(), name='post_detail'),
10 | ]
11 |
--------------------------------------------------------------------------------
/Django/10-basic-working-with-data-model-in-django/requirements.txt:
--------------------------------------------------------------------------------
1 | asgiref==3.2.10
2 | Django==3.0.8
3 | django-dotenv==1.4.2
4 | pytz==2020.1
5 | sqlparse==0.3.1
6 |
--------------------------------------------------------------------------------
/Django/11-working-with-dynamic-url-and-link-building-in-django/helloworld/.env:
--------------------------------------------------------------------------------
1 | SECRET_KEY=16cczc3*@+8t#g*4_da9+zuj)ql_5^a4-ho0r9aj!&r$wj=-g6
2 | MEMCACHE_HOST=127.0.0.1.8008
--------------------------------------------------------------------------------
/Django/11-working-with-dynamic-url-and-link-building-in-django/helloworld/db.sqlite3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/11-working-with-dynamic-url-and-link-building-in-django/helloworld/db.sqlite3
--------------------------------------------------------------------------------
/Django/11-working-with-dynamic-url-and-link-building-in-django/helloworld/helloworld/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/11-working-with-dynamic-url-and-link-building-in-django/helloworld/helloworld/__init__.py
--------------------------------------------------------------------------------
/Django/11-working-with-dynamic-url-and-link-building-in-django/helloworld/helloworld/asgi.py:
--------------------------------------------------------------------------------
1 | """
2 | ASGI config for helloworld project.
3 |
4 | It exposes the ASGI callable as a module-level variable named ``application``.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/
8 | """
9 |
10 | import os
11 |
12 | from django.core.asgi import get_asgi_application
13 |
14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'helloworld.settings')
15 |
16 | application = get_asgi_application()
17 |
--------------------------------------------------------------------------------
/Django/11-working-with-dynamic-url-and-link-building-in-django/helloworld/helloworld/wsgi.py:
--------------------------------------------------------------------------------
1 | """
2 | WSGI config for helloworld project.
3 |
4 | It exposes the WSGI callable as a module-level variable named ``application``.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/
8 | """
9 |
10 | import os
11 |
12 | from django.core.wsgi import get_wsgi_application
13 |
14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'helloworld.settings')
15 |
16 | application = get_wsgi_application()
17 |
--------------------------------------------------------------------------------
/Django/11-working-with-dynamic-url-and-link-building-in-django/helloworld/posts/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/11-working-with-dynamic-url-and-link-building-in-django/helloworld/posts/__init__.py
--------------------------------------------------------------------------------
/Django/11-working-with-dynamic-url-and-link-building-in-django/helloworld/posts/admin.py:
--------------------------------------------------------------------------------
1 | from django.contrib import admin
2 |
3 | # Register your models here.
4 | from .models import Post, Category
5 |
6 | admin.site.register(Post)
7 | admin.site.register(Category)
--------------------------------------------------------------------------------
/Django/11-working-with-dynamic-url-and-link-building-in-django/helloworld/posts/apps.py:
--------------------------------------------------------------------------------
1 | from django.apps import AppConfig
2 |
3 |
4 | class PostsConfig(AppConfig):
5 | name = 'posts'
6 |
--------------------------------------------------------------------------------
/Django/11-working-with-dynamic-url-and-link-building-in-django/helloworld/posts/migrations/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/11-working-with-dynamic-url-and-link-building-in-django/helloworld/posts/migrations/__init__.py
--------------------------------------------------------------------------------
/Django/11-working-with-dynamic-url-and-link-building-in-django/helloworld/posts/models.py:
--------------------------------------------------------------------------------
1 | from django.db import models
2 |
3 |
4 | class Category(models.Model):
5 | title = models.CharField(max_length=100)
6 |
7 | def __str__(self):
8 | return f'{self.title}'
9 |
10 |
11 | class Post(models.Model):
12 | title = models.CharField(max_length=200)
13 | content = models.TextField()
14 | category = models.ForeignKey(Category, on_delete=models.CASCADE)
15 |
16 | created_at = models.DateField()
17 |
18 | def __str__(self):
19 | return f'{self.title} at {self.created_at}'
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Django/11-working-with-dynamic-url-and-link-building-in-django/helloworld/posts/templates/main.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | My post jinja temaplte for Django!
6 |
7 |
8 |
9 | {% block content %}
10 |
11 | Content temaplte block missing, pls fill out
12 |
13 | {% endblock %}
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Django/11-working-with-dynamic-url-and-link-building-in-django/helloworld/posts/templates/post_detail.html:
--------------------------------------------------------------------------------
1 | {% extends "main.html" %}
2 |
3 | {% block content %}
4 | {{ post.title }}
5 |
6 | Created at {{ post.created_at }} in category: {{ post.category }}
7 |
8 |
9 |
10 | {{ post.content }}
11 |
12 |
13 |
14 | <- Go back
15 |
16 | {% endblock %}
--------------------------------------------------------------------------------
/Django/11-working-with-dynamic-url-and-link-building-in-django/helloworld/posts/templates/post_list.html:
--------------------------------------------------------------------------------
1 | {% extends "main.html" %}
2 |
3 | {% block content %}
4 |
8 |
9 |
10 |
11 | Session data
12 | {{ session }}
13 |
14 | {{ title }}
15 | {{ description }}
16 |
17 |
22 | {% endblock %}
--------------------------------------------------------------------------------
/Django/11-working-with-dynamic-url-and-link-building-in-django/helloworld/posts/templates/set-cookie-page.html:
--------------------------------------------------------------------------------
1 | {% extends "main.html" %}
2 |
3 | {% block content %}
4 | Set cookie pages!
5 | You have set the cookie now
6 |
7 | <- Go back
8 | {% endblock %}
--------------------------------------------------------------------------------
/Django/11-working-with-dynamic-url-and-link-building-in-django/helloworld/posts/templates/set-session-page.html:
--------------------------------------------------------------------------------
1 | {% extends "main.html" %}
2 |
3 | {% block content %}
4 | Set session page
5 | Session now set!
6 |
7 | <- Go back
8 | {% endblock %}
--------------------------------------------------------------------------------
/Django/11-working-with-dynamic-url-and-link-building-in-django/helloworld/posts/tests.py:
--------------------------------------------------------------------------------
1 | from django.test import TestCase
2 |
3 | # Create your tests here.
4 |
--------------------------------------------------------------------------------
/Django/11-working-with-dynamic-url-and-link-building-in-django/helloworld/posts/urls.py:
--------------------------------------------------------------------------------
1 | from django.urls import path, re_path
2 | from . import views
3 | from .views import PostDetail, PostList, PostSetSessionPage
4 |
5 | urlpatterns = [
6 | path('', PostList.as_view(), name='list-post'),
7 | path('set-cookie', views.set_cookie_demo_page, name='cookie-page'),
8 | path('set-session', PostSetSessionPage.as_view(), name='session-page'),
9 | re_path(r'^(?P\d+)', PostDetail.as_view(), name='post-details'),
10 | ]
11 |
--------------------------------------------------------------------------------
/Django/11-working-with-dynamic-url-and-link-building-in-django/requirements.txt:
--------------------------------------------------------------------------------
1 | asgiref==3.2.10
2 | Django==3.0.8
3 | django-dotenv==1.4.2
4 | pytz==2020.1
5 | sqlparse==0.3.1
6 |
--------------------------------------------------------------------------------
/Django/12-working-with-styling-static-content-and-image/helloworld/.env:
--------------------------------------------------------------------------------
1 | SECRET_KEY=16cczc3*@+8t#g*4_da9+zuj)ql_5^a4-ho0r9aj!&r$wj=-g6
2 | MEMCACHE_HOST=127.0.0.1.8008
--------------------------------------------------------------------------------
/Django/12-working-with-styling-static-content-and-image/helloworld/db.sqlite3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/12-working-with-styling-static-content-and-image/helloworld/db.sqlite3
--------------------------------------------------------------------------------
/Django/12-working-with-styling-static-content-and-image/helloworld/helloworld/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/12-working-with-styling-static-content-and-image/helloworld/helloworld/__init__.py
--------------------------------------------------------------------------------
/Django/12-working-with-styling-static-content-and-image/helloworld/helloworld/asgi.py:
--------------------------------------------------------------------------------
1 | """
2 | ASGI config for helloworld project.
3 |
4 | It exposes the ASGI callable as a module-level variable named ``application``.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/
8 | """
9 |
10 | import os
11 |
12 | from django.core.asgi import get_asgi_application
13 |
14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'helloworld.settings')
15 |
16 | application = get_asgi_application()
17 |
--------------------------------------------------------------------------------
/Django/12-working-with-styling-static-content-and-image/helloworld/helloworld/wsgi.py:
--------------------------------------------------------------------------------
1 | """
2 | WSGI config for helloworld project.
3 |
4 | It exposes the WSGI callable as a module-level variable named ``application``.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/
8 | """
9 |
10 | import os
11 |
12 | from django.core.wsgi import get_wsgi_application
13 |
14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'helloworld.settings')
15 |
16 | application = get_wsgi_application()
17 |
--------------------------------------------------------------------------------
/Django/12-working-with-styling-static-content-and-image/helloworld/posts/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/12-working-with-styling-static-content-and-image/helloworld/posts/__init__.py
--------------------------------------------------------------------------------
/Django/12-working-with-styling-static-content-and-image/helloworld/posts/admin.py:
--------------------------------------------------------------------------------
1 | from django.contrib import admin
2 |
3 | # Register your models here.
4 | from .models import Post, Category
5 |
6 | admin.site.register(Post)
7 | admin.site.register(Category)
--------------------------------------------------------------------------------
/Django/12-working-with-styling-static-content-and-image/helloworld/posts/apps.py:
--------------------------------------------------------------------------------
1 | from django.apps import AppConfig
2 |
3 |
4 | class PostsConfig(AppConfig):
5 | name = 'posts'
6 |
--------------------------------------------------------------------------------
/Django/12-working-with-styling-static-content-and-image/helloworld/posts/migrations/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/12-working-with-styling-static-content-and-image/helloworld/posts/migrations/__init__.py
--------------------------------------------------------------------------------
/Django/12-working-with-styling-static-content-and-image/helloworld/posts/models.py:
--------------------------------------------------------------------------------
1 | from django.db import models
2 |
3 |
4 | class Category(models.Model):
5 | title = models.CharField(max_length=100)
6 |
7 | def __str__(self):
8 | return f'{self.title}'
9 |
10 |
11 | class Post(models.Model):
12 | title = models.CharField(max_length=200)
13 | content = models.TextField()
14 | category = models.ForeignKey(Category, on_delete=models.CASCADE)
15 |
16 | created_at = models.DateField()
17 |
18 | def __str__(self):
19 | return f'{self.title} at {self.created_at}'
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Django/12-working-with-styling-static-content-and-image/helloworld/posts/static/css/main.css:
--------------------------------------------------------------------------------
1 | body {
2 | background: deepskyblue;
3 | }
--------------------------------------------------------------------------------
/Django/12-working-with-styling-static-content-and-image/helloworld/posts/static/image/cookie-lover.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/12-working-with-styling-static-content-and-image/helloworld/posts/static/image/cookie-lover.jpg
--------------------------------------------------------------------------------
/Django/12-working-with-styling-static-content-and-image/helloworld/posts/templates/main.html:
--------------------------------------------------------------------------------
1 | {% load static %}
2 |
3 |
4 |
5 |
6 | My post jinja temaplte for Django!
7 |
8 |
9 |
10 |
11 | {% block content %}
12 |
13 | Content temaplte block missing, pls fill out
14 |
15 | {% endblock %}
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Django/12-working-with-styling-static-content-and-image/helloworld/posts/templates/post_detail.html:
--------------------------------------------------------------------------------
1 | {% extends "main.html" %}
2 |
3 | {% block content %}
4 | {{ post.title }}
5 |
6 | Created at {{ post.created_at }} in category: {{ post.category }}
7 |
8 |
9 |
10 | {{ post.content }}
11 |
12 |
13 |
14 | <- Go back
15 |
16 | {% endblock %}
--------------------------------------------------------------------------------
/Django/12-working-with-styling-static-content-and-image/helloworld/posts/templates/post_list.html:
--------------------------------------------------------------------------------
1 | {% extends "main.html" %}
2 |
3 | {% block content %}
4 |
8 |
9 |
10 |
11 | Session data
12 | {{ session }}
13 |
14 | {{ title }}
15 | {{ description }}
16 |
17 |
22 | {% endblock %}
--------------------------------------------------------------------------------
/Django/12-working-with-styling-static-content-and-image/helloworld/posts/templates/set-cookie-page.html:
--------------------------------------------------------------------------------
1 | {% extends "main.html" %}
2 | {% load static %}
3 |
4 | {% block content %}
5 |
6 | Set cookie pages!
7 | You have set the cookie now
8 |
9 | <- Go back
10 | {% endblock %}
--------------------------------------------------------------------------------
/Django/12-working-with-styling-static-content-and-image/helloworld/posts/templates/set-session-page.html:
--------------------------------------------------------------------------------
1 | {% extends "main.html" %}
2 |
3 | {% block content %}
4 | Set session page
5 | Session now set!
6 |
7 | <- Go back
8 | {% endblock %}
--------------------------------------------------------------------------------
/Django/12-working-with-styling-static-content-and-image/helloworld/posts/tests.py:
--------------------------------------------------------------------------------
1 | from django.test import TestCase
2 |
3 | # Create your tests here.
4 |
--------------------------------------------------------------------------------
/Django/12-working-with-styling-static-content-and-image/helloworld/posts/urls.py:
--------------------------------------------------------------------------------
1 | from django.urls import path, re_path
2 | from . import views
3 | from .views import PostDetail, PostList, PostSetSessionPage
4 |
5 | urlpatterns = [
6 | path('', PostList.as_view(), name='list-post'),
7 | path('set-cookie', views.set_cookie_demo_page, name='cookie-page'),
8 | path('set-session', PostSetSessionPage.as_view(), name='session-page'),
9 | re_path(r'^(?P\d+)', PostDetail.as_view(), name='post-details'),
10 | ]
11 |
--------------------------------------------------------------------------------
/Django/12-working-with-styling-static-content-and-image/requirements.txt:
--------------------------------------------------------------------------------
1 | asgiref==3.2.10
2 | Django==3.0.8
3 | django-dotenv==1.4.2
4 | pytz==2020.1
5 | sqlparse==0.3.1
6 |
--------------------------------------------------------------------------------
/Django/13-how-to-use-vuejs-in-django-project/djangoserver/db.sqlite3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/13-how-to-use-vuejs-in-django-project/djangoserver/db.sqlite3
--------------------------------------------------------------------------------
/Django/13-how-to-use-vuejs-in-django-project/djangoserver/djangoserver/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/13-how-to-use-vuejs-in-django-project/djangoserver/djangoserver/__init__.py
--------------------------------------------------------------------------------
/Django/13-how-to-use-vuejs-in-django-project/djangoserver/djangoserver/asgi.py:
--------------------------------------------------------------------------------
1 | """
2 | ASGI config for djangoserver project.
3 |
4 | It exposes the ASGI callable as a module-level variable named ``application``.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/
8 | """
9 |
10 | import os
11 |
12 | from django.core.asgi import get_asgi_application
13 |
14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'djangoserver.settings')
15 |
16 | application = get_asgi_application()
17 |
--------------------------------------------------------------------------------
/Django/13-how-to-use-vuejs-in-django-project/djangoserver/djangoserver/wsgi.py:
--------------------------------------------------------------------------------
1 | """
2 | WSGI config for djangoserver project.
3 |
4 | It exposes the WSGI callable as a module-level variable named ``application``.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/
8 | """
9 |
10 | import os
11 |
12 | from django.core.wsgi import get_wsgi_application
13 |
14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'djangoserver.settings')
15 |
16 | application = get_wsgi_application()
17 |
--------------------------------------------------------------------------------
/Django/13-how-to-use-vuejs-in-django-project/djangoserver/manage.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | """Django's command-line utility for administrative tasks."""
3 | import os
4 | import sys
5 |
6 |
7 | def main():
8 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'djangoserver.settings')
9 | try:
10 | from django.core.management import execute_from_command_line
11 | except ImportError as exc:
12 | raise ImportError(
13 | "Couldn't import Django. Are you sure it's installed and "
14 | "available on your PYTHONPATH environment variable? Did you "
15 | "forget to activate a virtual environment?"
16 | ) from exc
17 | execute_from_command_line(sys.argv)
18 |
19 |
20 | if __name__ == '__main__':
21 | main()
22 |
--------------------------------------------------------------------------------
/Django/13-how-to-use-vuejs-in-django-project/djangoserver/posts/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/13-how-to-use-vuejs-in-django-project/djangoserver/posts/__init__.py
--------------------------------------------------------------------------------
/Django/13-how-to-use-vuejs-in-django-project/djangoserver/posts/admin.py:
--------------------------------------------------------------------------------
1 | from django.contrib import admin
2 |
3 | # Register your models here.
4 |
--------------------------------------------------------------------------------
/Django/13-how-to-use-vuejs-in-django-project/djangoserver/posts/apps.py:
--------------------------------------------------------------------------------
1 | from django.apps import AppConfig
2 |
3 |
4 | class PostsConfig(AppConfig):
5 | name = 'posts'
6 |
--------------------------------------------------------------------------------
/Django/13-how-to-use-vuejs-in-django-project/djangoserver/posts/migrations/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/13-how-to-use-vuejs-in-django-project/djangoserver/posts/migrations/__init__.py
--------------------------------------------------------------------------------
/Django/13-how-to-use-vuejs-in-django-project/djangoserver/posts/models.py:
--------------------------------------------------------------------------------
1 | from django.db import models
2 |
3 | # Create your models here.
4 |
--------------------------------------------------------------------------------
/Django/13-how-to-use-vuejs-in-django-project/djangoserver/posts/tests.py:
--------------------------------------------------------------------------------
1 | from django.test import TestCase
2 |
3 | # Create your tests here.
4 |
--------------------------------------------------------------------------------
/Django/13-how-to-use-vuejs-in-django-project/djangoserver/posts/urls.py:
--------------------------------------------------------------------------------
1 | from django.urls import path
2 | from . import views
3 |
4 | urlpatterns = [
5 | path('', views.post_list, name='post-list'),
6 | ]
7 |
--------------------------------------------------------------------------------
/Django/13-how-to-use-vuejs-in-django-project/djangoserver/posts/views.py:
--------------------------------------------------------------------------------
1 | from django.shortcuts import render
2 | from rest_framework.decorators import api_view
3 | from django.http import HttpResponse
4 |
5 |
6 | # Create your views here.
7 | @api_view(['GET'])
8 | def post_list(request):
9 | return HttpResponse('You get a post list here! :)')
10 |
--------------------------------------------------------------------------------
/Django/13-how-to-use-vuejs-in-django-project/djangoserver/requirements.txt:
--------------------------------------------------------------------------------
1 | asgiref==3.2.10
2 | Django==3.0.8
3 | django-dotenv==1.4.2
4 | pytz==2020.1
5 | sqlparse==0.3.1
6 |
--------------------------------------------------------------------------------
/Django/13-how-to-use-vuejs-in-django-project/vueclient/.browserslistrc:
--------------------------------------------------------------------------------
1 | > 1%
2 | last 2 versions
3 | not dead
4 |
--------------------------------------------------------------------------------
/Django/13-how-to-use-vuejs-in-django-project/vueclient/README.md:
--------------------------------------------------------------------------------
1 | # vueclient
2 |
3 | ## Project setup
4 | ```
5 | npm install
6 | ```
7 |
8 | ### Compiles and hot-reloads for development
9 | ```
10 | npm run serve
11 | ```
12 |
13 | ### Compiles and minifies for production
14 | ```
15 | npm run build
16 | ```
17 |
18 | ### Customize configuration
19 | See [Configuration Reference](https://cli.vuejs.org/config/).
20 |
--------------------------------------------------------------------------------
/Django/13-how-to-use-vuejs-in-django-project/vueclient/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: [
3 | '@vue/cli-plugin-babel/preset'
4 | ]
5 | }
6 |
--------------------------------------------------------------------------------
/Django/13-how-to-use-vuejs-in-django-project/vueclient/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/13-how-to-use-vuejs-in-django-project/vueclient/public/favicon.ico
--------------------------------------------------------------------------------
/Django/13-how-to-use-vuejs-in-django-project/vueclient/public/img/icons/android-chrome-192x192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/13-how-to-use-vuejs-in-django-project/vueclient/public/img/icons/android-chrome-192x192.png
--------------------------------------------------------------------------------
/Django/13-how-to-use-vuejs-in-django-project/vueclient/public/img/icons/android-chrome-512x512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/13-how-to-use-vuejs-in-django-project/vueclient/public/img/icons/android-chrome-512x512.png
--------------------------------------------------------------------------------
/Django/13-how-to-use-vuejs-in-django-project/vueclient/public/img/icons/android-chrome-maskable-192x192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/13-how-to-use-vuejs-in-django-project/vueclient/public/img/icons/android-chrome-maskable-192x192.png
--------------------------------------------------------------------------------
/Django/13-how-to-use-vuejs-in-django-project/vueclient/public/img/icons/android-chrome-maskable-512x512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/13-how-to-use-vuejs-in-django-project/vueclient/public/img/icons/android-chrome-maskable-512x512.png
--------------------------------------------------------------------------------
/Django/13-how-to-use-vuejs-in-django-project/vueclient/public/img/icons/apple-touch-icon-120x120.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/13-how-to-use-vuejs-in-django-project/vueclient/public/img/icons/apple-touch-icon-120x120.png
--------------------------------------------------------------------------------
/Django/13-how-to-use-vuejs-in-django-project/vueclient/public/img/icons/apple-touch-icon-152x152.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/13-how-to-use-vuejs-in-django-project/vueclient/public/img/icons/apple-touch-icon-152x152.png
--------------------------------------------------------------------------------
/Django/13-how-to-use-vuejs-in-django-project/vueclient/public/img/icons/apple-touch-icon-180x180.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/13-how-to-use-vuejs-in-django-project/vueclient/public/img/icons/apple-touch-icon-180x180.png
--------------------------------------------------------------------------------
/Django/13-how-to-use-vuejs-in-django-project/vueclient/public/img/icons/apple-touch-icon-60x60.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/13-how-to-use-vuejs-in-django-project/vueclient/public/img/icons/apple-touch-icon-60x60.png
--------------------------------------------------------------------------------
/Django/13-how-to-use-vuejs-in-django-project/vueclient/public/img/icons/apple-touch-icon-76x76.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/13-how-to-use-vuejs-in-django-project/vueclient/public/img/icons/apple-touch-icon-76x76.png
--------------------------------------------------------------------------------
/Django/13-how-to-use-vuejs-in-django-project/vueclient/public/img/icons/apple-touch-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/13-how-to-use-vuejs-in-django-project/vueclient/public/img/icons/apple-touch-icon.png
--------------------------------------------------------------------------------
/Django/13-how-to-use-vuejs-in-django-project/vueclient/public/img/icons/favicon-16x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/13-how-to-use-vuejs-in-django-project/vueclient/public/img/icons/favicon-16x16.png
--------------------------------------------------------------------------------
/Django/13-how-to-use-vuejs-in-django-project/vueclient/public/img/icons/favicon-32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/13-how-to-use-vuejs-in-django-project/vueclient/public/img/icons/favicon-32x32.png
--------------------------------------------------------------------------------
/Django/13-how-to-use-vuejs-in-django-project/vueclient/public/img/icons/msapplication-icon-144x144.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/13-how-to-use-vuejs-in-django-project/vueclient/public/img/icons/msapplication-icon-144x144.png
--------------------------------------------------------------------------------
/Django/13-how-to-use-vuejs-in-django-project/vueclient/public/img/icons/mstile-150x150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/13-how-to-use-vuejs-in-django-project/vueclient/public/img/icons/mstile-150x150.png
--------------------------------------------------------------------------------
/Django/13-how-to-use-vuejs-in-django-project/vueclient/public/img/icons/safari-pinned-tab.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/Django/13-how-to-use-vuejs-in-django-project/vueclient/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | <%= htmlWebpackPlugin.options.title %>
9 |
10 |
11 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Django/13-how-to-use-vuejs-in-django-project/vueclient/public/robots.txt:
--------------------------------------------------------------------------------
1 | User-agent: *
2 | Disallow:
3 |
--------------------------------------------------------------------------------
/Django/13-how-to-use-vuejs-in-django-project/vueclient/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Home |
5 | About
6 |
7 |
8 |
9 |
10 |
11 |
33 |
--------------------------------------------------------------------------------
/Django/13-how-to-use-vuejs-in-django-project/vueclient/src/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/13-how-to-use-vuejs-in-django-project/vueclient/src/assets/logo.png
--------------------------------------------------------------------------------
/Django/13-how-to-use-vuejs-in-django-project/vueclient/src/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import App from './App.vue'
3 | import './registerServiceWorker'
4 | import router from './router'
5 | import store from './store'
6 |
7 | Vue.config.productionTip = false
8 |
9 | new Vue({
10 | router,
11 | store,
12 | render: h => h(App)
13 | }).$mount('#app')
14 |
--------------------------------------------------------------------------------
/Django/13-how-to-use-vuejs-in-django-project/vueclient/src/router/index.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import VueRouter from 'vue-router'
3 | import Home from '../views/Home.vue'
4 |
5 | Vue.use(VueRouter)
6 |
7 | const routes = [
8 | {
9 | path: '/',
10 | name: 'Home',
11 | component: Home
12 | }
13 | ]
14 |
15 | const router = new VueRouter({
16 | mode: 'history',
17 | base: process.env.BASE_URL,
18 | routes
19 | })
20 |
21 | export default router
22 |
--------------------------------------------------------------------------------
/Django/13-how-to-use-vuejs-in-django-project/vueclient/src/store/index.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import Vuex from 'vuex'
3 |
4 | Vue.use(Vuex)
5 |
6 | export default new Vuex.Store({
7 | state: {
8 | },
9 | mutations: {
10 | },
11 | actions: {
12 | },
13 | modules: {
14 | }
15 | })
16 |
--------------------------------------------------------------------------------
/Django/13-how-to-use-vuejs-in-django-project/vueclient/src/views/Home.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | Welcom to API test!
4 | api data: {{post_data}}
5 |
6 |
7 |
8 |
9 |
43 |
--------------------------------------------------------------------------------
/Django/2-url-mapping-with-regex-reular-expression-with-django/helloworld/db.sqlite3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/2-url-mapping-with-regex-reular-expression-with-django/helloworld/db.sqlite3
--------------------------------------------------------------------------------
/Django/2-url-mapping-with-regex-reular-expression-with-django/helloworld/helloworld/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/2-url-mapping-with-regex-reular-expression-with-django/helloworld/helloworld/__init__.py
--------------------------------------------------------------------------------
/Django/2-url-mapping-with-regex-reular-expression-with-django/helloworld/helloworld/asgi.py:
--------------------------------------------------------------------------------
1 | """
2 | ASGI config for helloworld project.
3 |
4 | It exposes the ASGI callable as a module-level variable named ``application``.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/
8 | """
9 |
10 | import os
11 |
12 | from django.core.asgi import get_asgi_application
13 |
14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'helloworld.settings')
15 |
16 | application = get_asgi_application()
17 |
--------------------------------------------------------------------------------
/Django/2-url-mapping-with-regex-reular-expression-with-django/helloworld/helloworld/wsgi.py:
--------------------------------------------------------------------------------
1 | """
2 | WSGI config for helloworld project.
3 |
4 | It exposes the WSGI callable as a module-level variable named ``application``.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/
8 | """
9 |
10 | import os
11 |
12 | from django.core.wsgi import get_wsgi_application
13 |
14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'helloworld.settings')
15 |
16 | application = get_wsgi_application()
17 |
--------------------------------------------------------------------------------
/Django/2-url-mapping-with-regex-reular-expression-with-django/helloworld/manage.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | """Django's command-line utility for administrative tasks."""
3 | import os
4 | import sys
5 |
6 |
7 | def main():
8 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'helloworld.settings')
9 | try:
10 | from django.core.management import execute_from_command_line
11 | except ImportError as exc:
12 | raise ImportError(
13 | "Couldn't import Django. Are you sure it's installed and "
14 | "available on your PYTHONPATH environment variable? Did you "
15 | "forget to activate a virtual environment?"
16 | ) from exc
17 | execute_from_command_line(sys.argv)
18 |
19 |
20 | if __name__ == '__main__':
21 | main()
22 |
--------------------------------------------------------------------------------
/Django/2-url-mapping-with-regex-reular-expression-with-django/helloworld/posts/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/2-url-mapping-with-regex-reular-expression-with-django/helloworld/posts/__init__.py
--------------------------------------------------------------------------------
/Django/2-url-mapping-with-regex-reular-expression-with-django/helloworld/posts/admin.py:
--------------------------------------------------------------------------------
1 | from django.contrib import admin
2 |
3 | # Register your models here.
4 |
--------------------------------------------------------------------------------
/Django/2-url-mapping-with-regex-reular-expression-with-django/helloworld/posts/apps.py:
--------------------------------------------------------------------------------
1 | from django.apps import AppConfig
2 |
3 |
4 | class PostsConfig(AppConfig):
5 | name = 'posts'
6 |
--------------------------------------------------------------------------------
/Django/2-url-mapping-with-regex-reular-expression-with-django/helloworld/posts/migrations/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/2-url-mapping-with-regex-reular-expression-with-django/helloworld/posts/migrations/__init__.py
--------------------------------------------------------------------------------
/Django/2-url-mapping-with-regex-reular-expression-with-django/helloworld/posts/models.py:
--------------------------------------------------------------------------------
1 | from django.db import models
2 |
3 | # Create your models here.
4 |
--------------------------------------------------------------------------------
/Django/2-url-mapping-with-regex-reular-expression-with-django/helloworld/posts/tests.py:
--------------------------------------------------------------------------------
1 | from django.test import TestCase
2 |
3 | # Create your tests here.
4 |
--------------------------------------------------------------------------------
/Django/2-url-mapping-with-regex-reular-expression-with-django/helloworld/posts/urls.py:
--------------------------------------------------------------------------------
1 | from django.urls import path, re_path
2 | from . import views
3 |
4 | urlpatterns = [
5 | path('', views.index, name='index'),
6 | # re_path(r'^\d+', views.post_detail, name='post_detail'),
7 | re_path(r'^(?P\d+)', views.post_detail, name='post_detail'),
8 | ]
--------------------------------------------------------------------------------
/Django/2-url-mapping-with-regex-reular-expression-with-django/helloworld/posts/views.py:
--------------------------------------------------------------------------------
1 | from django.shortcuts import render
2 |
3 | # Create your views here.
4 | from django.http import HttpResponse
5 |
6 |
7 | def index(request):
8 | return HttpResponse('Hello world - our first index pages')
9 |
10 |
11 | def post_detail(request, number):
12 | return HttpResponse(f'Post detail view pages: {number}')
13 |
--------------------------------------------------------------------------------
/Django/2-url-mapping-with-regex-reular-expression-with-django/requirements.txt:
--------------------------------------------------------------------------------
1 | asgiref==3.2.10
2 | Django==3.0.8
3 | pytz==2020.1
4 | sqlparse==0.3.1
5 |
--------------------------------------------------------------------------------
/Django/3-working-with-jinja-template-engine-with-django/helloworld/db.sqlite3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/3-working-with-jinja-template-engine-with-django/helloworld/db.sqlite3
--------------------------------------------------------------------------------
/Django/3-working-with-jinja-template-engine-with-django/helloworld/helloworld/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/3-working-with-jinja-template-engine-with-django/helloworld/helloworld/__init__.py
--------------------------------------------------------------------------------
/Django/3-working-with-jinja-template-engine-with-django/helloworld/helloworld/asgi.py:
--------------------------------------------------------------------------------
1 | """
2 | ASGI config for helloworld project.
3 |
4 | It exposes the ASGI callable as a module-level variable named ``application``.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/
8 | """
9 |
10 | import os
11 |
12 | from django.core.asgi import get_asgi_application
13 |
14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'helloworld.settings')
15 |
16 | application = get_asgi_application()
17 |
--------------------------------------------------------------------------------
/Django/3-working-with-jinja-template-engine-with-django/helloworld/helloworld/wsgi.py:
--------------------------------------------------------------------------------
1 | """
2 | WSGI config for helloworld project.
3 |
4 | It exposes the WSGI callable as a module-level variable named ``application``.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/
8 | """
9 |
10 | import os
11 |
12 | from django.core.wsgi import get_wsgi_application
13 |
14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'helloworld.settings')
15 |
16 | application = get_wsgi_application()
17 |
--------------------------------------------------------------------------------
/Django/3-working-with-jinja-template-engine-with-django/helloworld/manage.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | """Django's command-line utility for administrative tasks."""
3 | import os
4 | import sys
5 |
6 |
7 | def main():
8 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'helloworld.settings')
9 | try:
10 | from django.core.management import execute_from_command_line
11 | except ImportError as exc:
12 | raise ImportError(
13 | "Couldn't import Django. Are you sure it's installed and "
14 | "available on your PYTHONPATH environment variable? Did you "
15 | "forget to activate a virtual environment?"
16 | ) from exc
17 | execute_from_command_line(sys.argv)
18 |
19 |
20 | if __name__ == '__main__':
21 | main()
22 |
--------------------------------------------------------------------------------
/Django/3-working-with-jinja-template-engine-with-django/helloworld/posts/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/3-working-with-jinja-template-engine-with-django/helloworld/posts/__init__.py
--------------------------------------------------------------------------------
/Django/3-working-with-jinja-template-engine-with-django/helloworld/posts/admin.py:
--------------------------------------------------------------------------------
1 | from django.contrib import admin
2 |
3 | # Register your models here.
4 |
--------------------------------------------------------------------------------
/Django/3-working-with-jinja-template-engine-with-django/helloworld/posts/apps.py:
--------------------------------------------------------------------------------
1 | from django.apps import AppConfig
2 |
3 |
4 | class PostsConfig(AppConfig):
5 | name = 'posts'
6 |
--------------------------------------------------------------------------------
/Django/3-working-with-jinja-template-engine-with-django/helloworld/posts/migrations/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/3-working-with-jinja-template-engine-with-django/helloworld/posts/migrations/__init__.py
--------------------------------------------------------------------------------
/Django/3-working-with-jinja-template-engine-with-django/helloworld/posts/models.py:
--------------------------------------------------------------------------------
1 | from django.db import models
2 |
3 | # Create your models here.
4 |
--------------------------------------------------------------------------------
/Django/3-working-with-jinja-template-engine-with-django/helloworld/posts/templates/main.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | My post jinja temaplte for Django!
6 |
7 |
8 |
9 | {% block content %}
10 |
11 | Content temaplte block missing, pls fill out
12 |
13 | {% endblock %}
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Django/3-working-with-jinja-template-engine-with-django/helloworld/posts/templates/post_detail.html:
--------------------------------------------------------------------------------
1 | {% extends "main.html" %}
2 |
3 | {% block content %}
4 | Detail view
5 | view number: {{number}}
6 | {% endblock %}
--------------------------------------------------------------------------------
/Django/3-working-with-jinja-template-engine-with-django/helloworld/posts/templates/post_list.html:
--------------------------------------------------------------------------------
1 | {% extends "main.html" %}
2 |
3 | {% block content %}
4 | List of all the blog posts
5 | Thanks for watch this! :)
6 | {% endblock %}
--------------------------------------------------------------------------------
/Django/3-working-with-jinja-template-engine-with-django/helloworld/posts/tests.py:
--------------------------------------------------------------------------------
1 | from django.test import TestCase
2 |
3 | # Create your tests here.
4 |
--------------------------------------------------------------------------------
/Django/3-working-with-jinja-template-engine-with-django/helloworld/posts/urls.py:
--------------------------------------------------------------------------------
1 | from django.urls import path, re_path
2 | from . import views
3 |
4 | urlpatterns = [
5 | path('', views.index, name='index'),
6 | # re_path(r'^\d+', views.post_detail, name='post_detail'),
7 | re_path(r'^(?P\d+)', views.post_detail, name='post_detail'),
8 | ]
--------------------------------------------------------------------------------
/Django/3-working-with-jinja-template-engine-with-django/helloworld/posts/views.py:
--------------------------------------------------------------------------------
1 | from django.shortcuts import render
2 |
3 | # Create your views here.
4 | from django.http import HttpResponse
5 |
6 |
7 | def index(request):
8 | return render(request, 'post_list.html', {
9 | })
10 |
11 |
12 | def post_detail(request, number):
13 | return render(request, 'post_detail.html', {
14 | 'number': number
15 | })
16 |
--------------------------------------------------------------------------------
/Django/3-working-with-jinja-template-engine-with-django/requirements.txt:
--------------------------------------------------------------------------------
1 | asgiref==3.2.10
2 | Django==3.0.8
3 | pytz==2020.1
4 | sqlparse==0.3.1
5 |
--------------------------------------------------------------------------------
/Django/4-how-to-working-with-class-based-view-in-django/helloworld/db.sqlite3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/4-how-to-working-with-class-based-view-in-django/helloworld/db.sqlite3
--------------------------------------------------------------------------------
/Django/4-how-to-working-with-class-based-view-in-django/helloworld/helloworld/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/4-how-to-working-with-class-based-view-in-django/helloworld/helloworld/__init__.py
--------------------------------------------------------------------------------
/Django/4-how-to-working-with-class-based-view-in-django/helloworld/helloworld/asgi.py:
--------------------------------------------------------------------------------
1 | """
2 | ASGI config for helloworld project.
3 |
4 | It exposes the ASGI callable as a module-level variable named ``application``.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/
8 | """
9 |
10 | import os
11 |
12 | from django.core.asgi import get_asgi_application
13 |
14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'helloworld.settings')
15 |
16 | application = get_asgi_application()
17 |
--------------------------------------------------------------------------------
/Django/4-how-to-working-with-class-based-view-in-django/helloworld/helloworld/wsgi.py:
--------------------------------------------------------------------------------
1 | """
2 | WSGI config for helloworld project.
3 |
4 | It exposes the WSGI callable as a module-level variable named ``application``.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/
8 | """
9 |
10 | import os
11 |
12 | from django.core.wsgi import get_wsgi_application
13 |
14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'helloworld.settings')
15 |
16 | application = get_wsgi_application()
17 |
--------------------------------------------------------------------------------
/Django/4-how-to-working-with-class-based-view-in-django/helloworld/manage.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | """Django's command-line utility for administrative tasks."""
3 | import os
4 | import sys
5 |
6 |
7 | def main():
8 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'helloworld.settings')
9 | try:
10 | from django.core.management import execute_from_command_line
11 | except ImportError as exc:
12 | raise ImportError(
13 | "Couldn't import Django. Are you sure it's installed and "
14 | "available on your PYTHONPATH environment variable? Did you "
15 | "forget to activate a virtual environment?"
16 | ) from exc
17 | execute_from_command_line(sys.argv)
18 |
19 |
20 | if __name__ == '__main__':
21 | main()
22 |
--------------------------------------------------------------------------------
/Django/4-how-to-working-with-class-based-view-in-django/helloworld/posts/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/4-how-to-working-with-class-based-view-in-django/helloworld/posts/__init__.py
--------------------------------------------------------------------------------
/Django/4-how-to-working-with-class-based-view-in-django/helloworld/posts/admin.py:
--------------------------------------------------------------------------------
1 | from django.contrib import admin
2 |
3 | # Register your models here.
4 |
--------------------------------------------------------------------------------
/Django/4-how-to-working-with-class-based-view-in-django/helloworld/posts/apps.py:
--------------------------------------------------------------------------------
1 | from django.apps import AppConfig
2 |
3 |
4 | class PostsConfig(AppConfig):
5 | name = 'posts'
6 |
--------------------------------------------------------------------------------
/Django/4-how-to-working-with-class-based-view-in-django/helloworld/posts/migrations/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/4-how-to-working-with-class-based-view-in-django/helloworld/posts/migrations/__init__.py
--------------------------------------------------------------------------------
/Django/4-how-to-working-with-class-based-view-in-django/helloworld/posts/models.py:
--------------------------------------------------------------------------------
1 | from django.db import models
2 |
3 | # Create your models here.
4 |
--------------------------------------------------------------------------------
/Django/4-how-to-working-with-class-based-view-in-django/helloworld/posts/templates/main.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | My post jinja temaplte for Django!
6 |
7 |
8 |
9 | {% block content %}
10 |
11 | Content temaplte block missing, pls fill out
12 |
13 | {% endblock %}
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Django/4-how-to-working-with-class-based-view-in-django/helloworld/posts/templates/post_detail.html:
--------------------------------------------------------------------------------
1 | {% extends "main.html" %}
2 |
3 | {% block content %}
4 | Detail view
5 | view number: {{number}}
6 | {% endblock %}
--------------------------------------------------------------------------------
/Django/4-how-to-working-with-class-based-view-in-django/helloworld/posts/templates/post_list.html:
--------------------------------------------------------------------------------
1 | {% extends "main.html" %}
2 |
3 | {% block content %}
4 | {{ title }}
5 | {{ description }}
6 | {% endblock %}
--------------------------------------------------------------------------------
/Django/4-how-to-working-with-class-based-view-in-django/helloworld/posts/tests.py:
--------------------------------------------------------------------------------
1 | from django.test import TestCase
2 |
3 | # Create your tests here.
4 |
--------------------------------------------------------------------------------
/Django/4-how-to-working-with-class-based-view-in-django/helloworld/posts/urls.py:
--------------------------------------------------------------------------------
1 | from django.urls import path, re_path
2 | from .views import PostDetail, PostList
3 |
4 | urlpatterns = [
5 | path('', PostList.as_view(), name='index'),
6 | re_path(r'^(?P\d+)', PostDetail.as_view(), name='post_detail'),
7 | ]
8 |
--------------------------------------------------------------------------------
/Django/4-how-to-working-with-class-based-view-in-django/helloworld/posts/views.py:
--------------------------------------------------------------------------------
1 | from django.shortcuts import render
2 | from django.views import View
3 | from django.views.generic import TemplateView
4 |
5 |
6 | class PostList(TemplateView):
7 | template_name = 'post_list.html'
8 |
9 | def get_context_data(self):
10 | context = {
11 | 'title': 'Post overview',
12 | 'description': 'A little list of all the post we got from the database.'
13 | }
14 |
15 | return context
16 |
17 |
18 | class PostDetail(View):
19 | def get(self, request, number):
20 | return render(request, 'post_detail.html', {
21 | 'number': number
22 | })
23 |
--------------------------------------------------------------------------------
/Django/4-how-to-working-with-class-based-view-in-django/requirements.txt:
--------------------------------------------------------------------------------
1 | asgiref==3.2.10
2 | Django==3.0.8
3 | pytz==2020.1
4 | sqlparse==0.3.1
5 |
--------------------------------------------------------------------------------
/Django/5-working-with-cookies-in-django/helloworld/db.sqlite3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/5-working-with-cookies-in-django/helloworld/db.sqlite3
--------------------------------------------------------------------------------
/Django/5-working-with-cookies-in-django/helloworld/helloworld/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/5-working-with-cookies-in-django/helloworld/helloworld/__init__.py
--------------------------------------------------------------------------------
/Django/5-working-with-cookies-in-django/helloworld/helloworld/asgi.py:
--------------------------------------------------------------------------------
1 | """
2 | ASGI config for helloworld project.
3 |
4 | It exposes the ASGI callable as a module-level variable named ``application``.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/
8 | """
9 |
10 | import os
11 |
12 | from django.core.asgi import get_asgi_application
13 |
14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'helloworld.settings')
15 |
16 | application = get_asgi_application()
17 |
--------------------------------------------------------------------------------
/Django/5-working-with-cookies-in-django/helloworld/helloworld/wsgi.py:
--------------------------------------------------------------------------------
1 | """
2 | WSGI config for helloworld project.
3 |
4 | It exposes the WSGI callable as a module-level variable named ``application``.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/
8 | """
9 |
10 | import os
11 |
12 | from django.core.wsgi import get_wsgi_application
13 |
14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'helloworld.settings')
15 |
16 | application = get_wsgi_application()
17 |
--------------------------------------------------------------------------------
/Django/5-working-with-cookies-in-django/helloworld/manage.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | """Django's command-line utility for administrative tasks."""
3 | import os
4 | import sys
5 |
6 |
7 | def main():
8 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'helloworld.settings')
9 | try:
10 | from django.core.management import execute_from_command_line
11 | except ImportError as exc:
12 | raise ImportError(
13 | "Couldn't import Django. Are you sure it's installed and "
14 | "available on your PYTHONPATH environment variable? Did you "
15 | "forget to activate a virtual environment?"
16 | ) from exc
17 | execute_from_command_line(sys.argv)
18 |
19 |
20 | if __name__ == '__main__':
21 | main()
22 |
--------------------------------------------------------------------------------
/Django/5-working-with-cookies-in-django/helloworld/posts/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/5-working-with-cookies-in-django/helloworld/posts/__init__.py
--------------------------------------------------------------------------------
/Django/5-working-with-cookies-in-django/helloworld/posts/admin.py:
--------------------------------------------------------------------------------
1 | from django.contrib import admin
2 |
3 | # Register your models here.
4 |
--------------------------------------------------------------------------------
/Django/5-working-with-cookies-in-django/helloworld/posts/apps.py:
--------------------------------------------------------------------------------
1 | from django.apps import AppConfig
2 |
3 |
4 | class PostsConfig(AppConfig):
5 | name = 'posts'
6 |
--------------------------------------------------------------------------------
/Django/5-working-with-cookies-in-django/helloworld/posts/migrations/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/5-working-with-cookies-in-django/helloworld/posts/migrations/__init__.py
--------------------------------------------------------------------------------
/Django/5-working-with-cookies-in-django/helloworld/posts/models.py:
--------------------------------------------------------------------------------
1 | from django.db import models
2 |
3 | # Create your models here.
4 |
--------------------------------------------------------------------------------
/Django/5-working-with-cookies-in-django/helloworld/posts/templates/main.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | My post jinja temaplte for Django!
6 |
7 |
8 |
9 | {% block content %}
10 |
11 | Content temaplte block missing, pls fill out
12 |
13 | {% endblock %}
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Django/5-working-with-cookies-in-django/helloworld/posts/templates/post_detail.html:
--------------------------------------------------------------------------------
1 | {% extends "main.html" %}
2 |
3 | {% block content %}
4 | <- Go back to post overview
5 |
6 |
7 |
8 | Detail view
9 | view number: {{number}}
10 | {% endblock %}
--------------------------------------------------------------------------------
/Django/5-working-with-cookies-in-django/helloworld/posts/templates/post_list.html:
--------------------------------------------------------------------------------
1 | {% extends "main.html" %}
2 |
3 | {% block content %}
4 | Set Cookie Demo ({{ cookie_data }})
5 |
6 |
7 |
8 | {{ title }}
9 | {{ description }}
10 |
11 |
16 | {% endblock %}
--------------------------------------------------------------------------------
/Django/5-working-with-cookies-in-django/helloworld/posts/templates/set-cookie-page.html:
--------------------------------------------------------------------------------
1 | {% extends "main.html" %}
2 |
3 | {% block content %}
4 | Set cookie pages!
5 | You have set the cookie now
6 |
7 | <- Go back
8 | {% endblock %}
--------------------------------------------------------------------------------
/Django/5-working-with-cookies-in-django/helloworld/posts/tests.py:
--------------------------------------------------------------------------------
1 | from django.test import TestCase
2 |
3 | # Create your tests here.
4 |
--------------------------------------------------------------------------------
/Django/5-working-with-cookies-in-django/helloworld/posts/urls.py:
--------------------------------------------------------------------------------
1 | from django.urls import path, re_path
2 | from . import views
3 | from .views import PostDetail, PostList
4 |
5 | urlpatterns = [
6 | path('', PostList.as_view(), name='index'),
7 | path('set-cookie-demo', views.set_cookie_demo_page, name='index'),
8 | re_path(r'^(?P\d+)', PostDetail.as_view(), name='post_detail'),
9 | ]
10 |
--------------------------------------------------------------------------------
/Django/5-working-with-cookies-in-django/requirements.txt:
--------------------------------------------------------------------------------
1 | asgiref==3.2.10
2 | Django==3.0.8
3 | pytz==2020.1
4 | sqlparse==0.3.1
5 |
--------------------------------------------------------------------------------
/Django/6-working-with-sessions-in-django/helloworld/db.sqlite3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/6-working-with-sessions-in-django/helloworld/db.sqlite3
--------------------------------------------------------------------------------
/Django/6-working-with-sessions-in-django/helloworld/helloworld/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/6-working-with-sessions-in-django/helloworld/helloworld/__init__.py
--------------------------------------------------------------------------------
/Django/6-working-with-sessions-in-django/helloworld/helloworld/asgi.py:
--------------------------------------------------------------------------------
1 | """
2 | ASGI config for helloworld project.
3 |
4 | It exposes the ASGI callable as a module-level variable named ``application``.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/
8 | """
9 |
10 | import os
11 |
12 | from django.core.asgi import get_asgi_application
13 |
14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'helloworld.settings')
15 |
16 | application = get_asgi_application()
17 |
--------------------------------------------------------------------------------
/Django/6-working-with-sessions-in-django/helloworld/helloworld/wsgi.py:
--------------------------------------------------------------------------------
1 | """
2 | WSGI config for helloworld project.
3 |
4 | It exposes the WSGI callable as a module-level variable named ``application``.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/
8 | """
9 |
10 | import os
11 |
12 | from django.core.wsgi import get_wsgi_application
13 |
14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'helloworld.settings')
15 |
16 | application = get_wsgi_application()
17 |
--------------------------------------------------------------------------------
/Django/6-working-with-sessions-in-django/helloworld/manage.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | """Django's command-line utility for administrative tasks."""
3 | import os
4 | import sys
5 |
6 |
7 | def main():
8 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'helloworld.settings')
9 | try:
10 | from django.core.management import execute_from_command_line
11 | except ImportError as exc:
12 | raise ImportError(
13 | "Couldn't import Django. Are you sure it's installed and "
14 | "available on your PYTHONPATH environment variable? Did you "
15 | "forget to activate a virtual environment?"
16 | ) from exc
17 | execute_from_command_line(sys.argv)
18 |
19 |
20 | if __name__ == '__main__':
21 | main()
22 |
--------------------------------------------------------------------------------
/Django/6-working-with-sessions-in-django/helloworld/posts/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/6-working-with-sessions-in-django/helloworld/posts/__init__.py
--------------------------------------------------------------------------------
/Django/6-working-with-sessions-in-django/helloworld/posts/admin.py:
--------------------------------------------------------------------------------
1 | from django.contrib import admin
2 |
3 | # Register your models here.
4 |
--------------------------------------------------------------------------------
/Django/6-working-with-sessions-in-django/helloworld/posts/apps.py:
--------------------------------------------------------------------------------
1 | from django.apps import AppConfig
2 |
3 |
4 | class PostsConfig(AppConfig):
5 | name = 'posts'
6 |
--------------------------------------------------------------------------------
/Django/6-working-with-sessions-in-django/helloworld/posts/migrations/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/6-working-with-sessions-in-django/helloworld/posts/migrations/__init__.py
--------------------------------------------------------------------------------
/Django/6-working-with-sessions-in-django/helloworld/posts/models.py:
--------------------------------------------------------------------------------
1 | from django.db import models
2 |
3 | # Create your models here.
4 |
--------------------------------------------------------------------------------
/Django/6-working-with-sessions-in-django/helloworld/posts/templates/main.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | My post jinja temaplte for Django!
6 |
7 |
8 |
9 | {% block content %}
10 |
11 | Content temaplte block missing, pls fill out
12 |
13 | {% endblock %}
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Django/6-working-with-sessions-in-django/helloworld/posts/templates/post_detail.html:
--------------------------------------------------------------------------------
1 | {% extends "main.html" %}
2 |
3 | {% block content %}
4 | <- Go back to post overview
5 |
6 |
7 |
8 | Detail view
9 | view number: {{number}}
10 | {% endblock %}
--------------------------------------------------------------------------------
/Django/6-working-with-sessions-in-django/helloworld/posts/templates/post_list.html:
--------------------------------------------------------------------------------
1 | {% extends "main.html" %}
2 |
3 | {% block content %}
4 |
8 |
9 |
10 |
11 | Session data
12 | {{ session }}
13 |
14 | {{ title }}
15 | {{ description }}
16 |
17 |
22 | {% endblock %}
--------------------------------------------------------------------------------
/Django/6-working-with-sessions-in-django/helloworld/posts/templates/set-cookie-page.html:
--------------------------------------------------------------------------------
1 | {% extends "main.html" %}
2 |
3 | {% block content %}
4 | Set cookie pages!
5 | You have set the cookie now
6 |
7 | <- Go back
8 | {% endblock %}
--------------------------------------------------------------------------------
/Django/6-working-with-sessions-in-django/helloworld/posts/templates/set-session-page.html:
--------------------------------------------------------------------------------
1 | {% extends "main.html" %}
2 |
3 | {% block content %}
4 | Set session page
5 | Session now set!
6 |
7 | <- Go back
8 | {% endblock %}
--------------------------------------------------------------------------------
/Django/6-working-with-sessions-in-django/helloworld/posts/tests.py:
--------------------------------------------------------------------------------
1 | from django.test import TestCase
2 |
3 | # Create your tests here.
4 |
--------------------------------------------------------------------------------
/Django/6-working-with-sessions-in-django/helloworld/posts/urls.py:
--------------------------------------------------------------------------------
1 | from django.urls import path, re_path
2 | from . import views
3 | from .views import PostDetail, PostList, PostSetSessionPage
4 |
5 | urlpatterns = [
6 | path('', PostList.as_view(), name='index'),
7 | path('set-cookie-demo', views.set_cookie_demo_page, name='cookie-page'),
8 | path('set-session-demo', PostSetSessionPage.as_view(), name='session-page'),
9 | re_path(r'^(?P\d+)', PostDetail.as_view(), name='post_detail'),
10 | ]
11 |
--------------------------------------------------------------------------------
/Django/6-working-with-sessions-in-django/requirements.txt:
--------------------------------------------------------------------------------
1 | asgiref==3.2.10
2 | Django==3.0.8
3 | pytz==2020.1
4 | sqlparse==0.3.1
5 |
--------------------------------------------------------------------------------
/Django/7-how-to-working-with-dotenv-in-django/helloworld/.env:
--------------------------------------------------------------------------------
1 | SECRET_KEY=16cczc3*@+8t#g*4_da9+zuj)ql_5^a4-ho0r9aj!&r$wj=-g6
2 | MEMCACHE_HOST=127.0.0.1.8008
--------------------------------------------------------------------------------
/Django/7-how-to-working-with-dotenv-in-django/helloworld/db.sqlite3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/7-how-to-working-with-dotenv-in-django/helloworld/db.sqlite3
--------------------------------------------------------------------------------
/Django/7-how-to-working-with-dotenv-in-django/helloworld/helloworld/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/7-how-to-working-with-dotenv-in-django/helloworld/helloworld/__init__.py
--------------------------------------------------------------------------------
/Django/7-how-to-working-with-dotenv-in-django/helloworld/helloworld/asgi.py:
--------------------------------------------------------------------------------
1 | """
2 | ASGI config for helloworld project.
3 |
4 | It exposes the ASGI callable as a module-level variable named ``application``.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/
8 | """
9 |
10 | import os
11 |
12 | from django.core.asgi import get_asgi_application
13 |
14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'helloworld.settings')
15 |
16 | application = get_asgi_application()
17 |
--------------------------------------------------------------------------------
/Django/7-how-to-working-with-dotenv-in-django/helloworld/helloworld/wsgi.py:
--------------------------------------------------------------------------------
1 | """
2 | WSGI config for helloworld project.
3 |
4 | It exposes the WSGI callable as a module-level variable named ``application``.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/
8 | """
9 |
10 | import os
11 |
12 | from django.core.wsgi import get_wsgi_application
13 |
14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'helloworld.settings')
15 |
16 | application = get_wsgi_application()
17 |
--------------------------------------------------------------------------------
/Django/7-how-to-working-with-dotenv-in-django/helloworld/manage.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | """Django's command-line utility for administrative tasks."""
3 | import os
4 | import sys
5 | import dotenv
6 |
7 |
8 | def main():
9 | dotenv.read_dotenv()
10 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'helloworld.settings')
11 | try:
12 | from django.core.management import execute_from_command_line
13 | except ImportError as exc:
14 | raise ImportError(
15 | "Couldn't import Django. Are you sure it's installed and "
16 | "available on your PYTHONPATH environment variable? Did you "
17 | "forget to activate a virtual environment?"
18 | ) from exc
19 | execute_from_command_line(sys.argv)
20 |
21 |
22 | if __name__ == '__main__':
23 | main()
24 |
--------------------------------------------------------------------------------
/Django/7-how-to-working-with-dotenv-in-django/helloworld/posts/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/7-how-to-working-with-dotenv-in-django/helloworld/posts/__init__.py
--------------------------------------------------------------------------------
/Django/7-how-to-working-with-dotenv-in-django/helloworld/posts/admin.py:
--------------------------------------------------------------------------------
1 | from django.contrib import admin
2 |
3 | # Register your models here.
4 |
--------------------------------------------------------------------------------
/Django/7-how-to-working-with-dotenv-in-django/helloworld/posts/apps.py:
--------------------------------------------------------------------------------
1 | from django.apps import AppConfig
2 |
3 |
4 | class PostsConfig(AppConfig):
5 | name = 'posts'
6 |
--------------------------------------------------------------------------------
/Django/7-how-to-working-with-dotenv-in-django/helloworld/posts/migrations/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/7-how-to-working-with-dotenv-in-django/helloworld/posts/migrations/__init__.py
--------------------------------------------------------------------------------
/Django/7-how-to-working-with-dotenv-in-django/helloworld/posts/models.py:
--------------------------------------------------------------------------------
1 | from django.db import models
2 |
3 | # Create your models here.
4 |
--------------------------------------------------------------------------------
/Django/7-how-to-working-with-dotenv-in-django/helloworld/posts/templates/main.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | My post jinja temaplte for Django!
6 |
7 |
8 |
9 | {% block content %}
10 |
11 | Content temaplte block missing, pls fill out
12 |
13 | {% endblock %}
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Django/7-how-to-working-with-dotenv-in-django/helloworld/posts/templates/post_detail.html:
--------------------------------------------------------------------------------
1 | {% extends "main.html" %}
2 |
3 | {% block content %}
4 | <- Go back to post overview
5 |
6 |
7 |
8 | Detail view
9 | view number: {{number}}
10 | {% endblock %}
--------------------------------------------------------------------------------
/Django/7-how-to-working-with-dotenv-in-django/helloworld/posts/templates/post_list.html:
--------------------------------------------------------------------------------
1 | {% extends "main.html" %}
2 |
3 | {% block content %}
4 |
8 |
9 |
10 |
11 | Session data
12 | {{ session }}
13 |
14 | {{ title }}
15 | {{ description }}
16 |
17 |
22 | {% endblock %}
--------------------------------------------------------------------------------
/Django/7-how-to-working-with-dotenv-in-django/helloworld/posts/templates/set-cookie-page.html:
--------------------------------------------------------------------------------
1 | {% extends "main.html" %}
2 |
3 | {% block content %}
4 | Set cookie pages!
5 | You have set the cookie now
6 |
7 | <- Go back
8 | {% endblock %}
--------------------------------------------------------------------------------
/Django/7-how-to-working-with-dotenv-in-django/helloworld/posts/templates/set-session-page.html:
--------------------------------------------------------------------------------
1 | {% extends "main.html" %}
2 |
3 | {% block content %}
4 | Set session page
5 | Session now set!
6 |
7 | <- Go back
8 | {% endblock %}
--------------------------------------------------------------------------------
/Django/7-how-to-working-with-dotenv-in-django/helloworld/posts/tests.py:
--------------------------------------------------------------------------------
1 | from django.test import TestCase
2 |
3 | # Create your tests here.
4 |
--------------------------------------------------------------------------------
/Django/7-how-to-working-with-dotenv-in-django/helloworld/posts/urls.py:
--------------------------------------------------------------------------------
1 | from django.urls import path, re_path
2 | from . import views
3 | from .views import PostDetail, PostList, PostSetSessionPage
4 |
5 | urlpatterns = [
6 | path('', PostList.as_view(), name='index'),
7 | path('set-cookie-demo', views.set_cookie_demo_page, name='cookie-page'),
8 | path('set-session-demo', PostSetSessionPage.as_view(), name='session-page'),
9 | re_path(r'^(?P\d+)', PostDetail.as_view(), name='post_detail'),
10 | ]
11 |
--------------------------------------------------------------------------------
/Django/7-how-to-working-with-dotenv-in-django/requirements.txt:
--------------------------------------------------------------------------------
1 | asgiref==3.2.10
2 | Django==3.0.8
3 | django-dotenv==1.4.2
4 | pytz==2020.1
5 | sqlparse==0.3.1
6 |
--------------------------------------------------------------------------------
/Django/8-create-model-for-your-django-application/helloworld/.env:
--------------------------------------------------------------------------------
1 | SECRET_KEY=16cczc3*@+8t#g*4_da9+zuj)ql_5^a4-ho0r9aj!&r$wj=-g6
2 | MEMCACHE_HOST=127.0.0.1.8008
--------------------------------------------------------------------------------
/Django/8-create-model-for-your-django-application/helloworld/db.sqlite3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/8-create-model-for-your-django-application/helloworld/db.sqlite3
--------------------------------------------------------------------------------
/Django/8-create-model-for-your-django-application/helloworld/helloworld/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/8-create-model-for-your-django-application/helloworld/helloworld/__init__.py
--------------------------------------------------------------------------------
/Django/8-create-model-for-your-django-application/helloworld/helloworld/asgi.py:
--------------------------------------------------------------------------------
1 | """
2 | ASGI config for helloworld project.
3 |
4 | It exposes the ASGI callable as a module-level variable named ``application``.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/
8 | """
9 |
10 | import os
11 |
12 | from django.core.asgi import get_asgi_application
13 |
14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'helloworld.settings')
15 |
16 | application = get_asgi_application()
17 |
--------------------------------------------------------------------------------
/Django/8-create-model-for-your-django-application/helloworld/helloworld/wsgi.py:
--------------------------------------------------------------------------------
1 | """
2 | WSGI config for helloworld project.
3 |
4 | It exposes the WSGI callable as a module-level variable named ``application``.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/
8 | """
9 |
10 | import os
11 |
12 | from django.core.wsgi import get_wsgi_application
13 |
14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'helloworld.settings')
15 |
16 | application = get_wsgi_application()
17 |
--------------------------------------------------------------------------------
/Django/8-create-model-for-your-django-application/helloworld/posts/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/8-create-model-for-your-django-application/helloworld/posts/__init__.py
--------------------------------------------------------------------------------
/Django/8-create-model-for-your-django-application/helloworld/posts/admin.py:
--------------------------------------------------------------------------------
1 | from django.contrib import admin
2 |
3 | # Register your models here.
4 |
--------------------------------------------------------------------------------
/Django/8-create-model-for-your-django-application/helloworld/posts/apps.py:
--------------------------------------------------------------------------------
1 | from django.apps import AppConfig
2 |
3 |
4 | class PostsConfig(AppConfig):
5 | name = 'posts'
6 |
--------------------------------------------------------------------------------
/Django/8-create-model-for-your-django-application/helloworld/posts/migrations/0001_initial.py:
--------------------------------------------------------------------------------
1 | # Generated by Django 3.0.8 on 2020-08-02 08:14
2 |
3 | from django.db import migrations, models
4 |
5 |
6 | class Migration(migrations.Migration):
7 |
8 | initial = True
9 |
10 | dependencies = [
11 | ]
12 |
13 | operations = [
14 | migrations.CreateModel(
15 | name='Post',
16 | fields=[
17 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
18 | ('title', models.CharField(max_length=200)),
19 | ('content', models.TextField()),
20 | ('created_at', models.DateField()),
21 | ],
22 | ),
23 | ]
24 |
--------------------------------------------------------------------------------
/Django/8-create-model-for-your-django-application/helloworld/posts/migrations/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/8-create-model-for-your-django-application/helloworld/posts/migrations/__init__.py
--------------------------------------------------------------------------------
/Django/8-create-model-for-your-django-application/helloworld/posts/models.py:
--------------------------------------------------------------------------------
1 | from django.db import models
2 |
3 |
4 | # Create your models here.
5 | class Post(models.Model):
6 | title = models.CharField(max_length=200)
7 | content = models.TextField()
8 |
9 | created_at = models.DateField()
--------------------------------------------------------------------------------
/Django/8-create-model-for-your-django-application/helloworld/posts/templates/main.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | My post jinja temaplte for Django!
6 |
7 |
8 |
9 | {% block content %}
10 |
11 | Content temaplte block missing, pls fill out
12 |
13 | {% endblock %}
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Django/8-create-model-for-your-django-application/helloworld/posts/templates/post_detail.html:
--------------------------------------------------------------------------------
1 | {% extends "main.html" %}
2 |
3 | {% block content %}
4 | <- Go back to post overview
5 |
6 |
7 |
8 | Detail view
9 | view number: {{number}}
10 | {% endblock %}
--------------------------------------------------------------------------------
/Django/8-create-model-for-your-django-application/helloworld/posts/templates/post_list.html:
--------------------------------------------------------------------------------
1 | {% extends "main.html" %}
2 |
3 | {% block content %}
4 |
8 |
9 |
10 |
11 | Session data
12 | {{ session }}
13 |
14 | {{ title }}
15 | {{ description }}
16 |
17 |
22 | {% endblock %}
--------------------------------------------------------------------------------
/Django/8-create-model-for-your-django-application/helloworld/posts/templates/set-cookie-page.html:
--------------------------------------------------------------------------------
1 | {% extends "main.html" %}
2 |
3 | {% block content %}
4 | Set cookie pages!
5 | You have set the cookie now
6 |
7 | <- Go back
8 | {% endblock %}
--------------------------------------------------------------------------------
/Django/8-create-model-for-your-django-application/helloworld/posts/templates/set-session-page.html:
--------------------------------------------------------------------------------
1 | {% extends "main.html" %}
2 |
3 | {% block content %}
4 | Set session page
5 | Session now set!
6 |
7 | <- Go back
8 | {% endblock %}
--------------------------------------------------------------------------------
/Django/8-create-model-for-your-django-application/helloworld/posts/tests.py:
--------------------------------------------------------------------------------
1 | from django.test import TestCase
2 |
3 | # Create your tests here.
4 |
--------------------------------------------------------------------------------
/Django/8-create-model-for-your-django-application/helloworld/posts/urls.py:
--------------------------------------------------------------------------------
1 | from django.urls import path, re_path
2 | from . import views
3 | from .views import PostDetail, PostList, PostSetSessionPage
4 |
5 | urlpatterns = [
6 | path('', PostList.as_view(), name='index'),
7 | path('set-cookie-demo', views.set_cookie_demo_page, name='cookie-page'),
8 | path('set-session-demo', PostSetSessionPage.as_view(), name='session-page'),
9 | re_path(r'^(?P\d+)', PostDetail.as_view(), name='post_detail'),
10 | ]
11 |
--------------------------------------------------------------------------------
/Django/8-create-model-for-your-django-application/requirements.txt:
--------------------------------------------------------------------------------
1 | asgiref==3.2.10
2 | Django==3.0.8
3 | django-dotenv==1.4.2
4 | pytz==2020.1
5 | sqlparse==0.3.1
6 |
--------------------------------------------------------------------------------
/Django/9-working-with-basic-admin-panel-with-model-in-django/helloworld/.env:
--------------------------------------------------------------------------------
1 | SECRET_KEY=16cczc3*@+8t#g*4_da9+zuj)ql_5^a4-ho0r9aj!&r$wj=-g6
2 | MEMCACHE_HOST=127.0.0.1.8008
--------------------------------------------------------------------------------
/Django/9-working-with-basic-admin-panel-with-model-in-django/helloworld/db.sqlite3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/9-working-with-basic-admin-panel-with-model-in-django/helloworld/db.sqlite3
--------------------------------------------------------------------------------
/Django/9-working-with-basic-admin-panel-with-model-in-django/helloworld/helloworld/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/9-working-with-basic-admin-panel-with-model-in-django/helloworld/helloworld/__init__.py
--------------------------------------------------------------------------------
/Django/9-working-with-basic-admin-panel-with-model-in-django/helloworld/helloworld/asgi.py:
--------------------------------------------------------------------------------
1 | """
2 | ASGI config for helloworld project.
3 |
4 | It exposes the ASGI callable as a module-level variable named ``application``.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/
8 | """
9 |
10 | import os
11 |
12 | from django.core.asgi import get_asgi_application
13 |
14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'helloworld.settings')
15 |
16 | application = get_asgi_application()
17 |
--------------------------------------------------------------------------------
/Django/9-working-with-basic-admin-panel-with-model-in-django/helloworld/helloworld/wsgi.py:
--------------------------------------------------------------------------------
1 | """
2 | WSGI config for helloworld project.
3 |
4 | It exposes the WSGI callable as a module-level variable named ``application``.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/
8 | """
9 |
10 | import os
11 |
12 | from django.core.wsgi import get_wsgi_application
13 |
14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'helloworld.settings')
15 |
16 | application = get_wsgi_application()
17 |
--------------------------------------------------------------------------------
/Django/9-working-with-basic-admin-panel-with-model-in-django/helloworld/posts/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/9-working-with-basic-admin-panel-with-model-in-django/helloworld/posts/__init__.py
--------------------------------------------------------------------------------
/Django/9-working-with-basic-admin-panel-with-model-in-django/helloworld/posts/admin.py:
--------------------------------------------------------------------------------
1 | from django.contrib import admin
2 |
3 | # Register your models here.
4 | from .models import Post, Category
5 |
6 | admin.site.register(Post)
7 | admin.site.register(Category)
--------------------------------------------------------------------------------
/Django/9-working-with-basic-admin-panel-with-model-in-django/helloworld/posts/apps.py:
--------------------------------------------------------------------------------
1 | from django.apps import AppConfig
2 |
3 |
4 | class PostsConfig(AppConfig):
5 | name = 'posts'
6 |
--------------------------------------------------------------------------------
/Django/9-working-with-basic-admin-panel-with-model-in-django/helloworld/posts/migrations/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Django/9-working-with-basic-admin-panel-with-model-in-django/helloworld/posts/migrations/__init__.py
--------------------------------------------------------------------------------
/Django/9-working-with-basic-admin-panel-with-model-in-django/helloworld/posts/models.py:
--------------------------------------------------------------------------------
1 | from django.db import models
2 |
3 |
4 | class Category(models.Model):
5 | title = models.CharField(max_length=100)
6 |
7 | def __str__(self):
8 | return f'{self.title}'
9 |
10 |
11 | class Post(models.Model):
12 | title = models.CharField(max_length=200)
13 | content = models.TextField()
14 | category = models.ForeignKey(Category, on_delete=models.CASCADE)
15 |
16 | created_at = models.DateField()
17 |
18 | def __str__(self):
19 | return f'{self.title} at {self.created_at}'
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Django/9-working-with-basic-admin-panel-with-model-in-django/helloworld/posts/templates/main.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | My post jinja temaplte for Django!
6 |
7 |
8 |
9 | {% block content %}
10 |
11 | Content temaplte block missing, pls fill out
12 |
13 | {% endblock %}
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Django/9-working-with-basic-admin-panel-with-model-in-django/helloworld/posts/templates/post_detail.html:
--------------------------------------------------------------------------------
1 | {% extends "main.html" %}
2 |
3 | {% block content %}
4 | <- Go back to post overview
5 |
6 |
7 |
8 | Detail view
9 | view number: {{number}}
10 | {% endblock %}
--------------------------------------------------------------------------------
/Django/9-working-with-basic-admin-panel-with-model-in-django/helloworld/posts/templates/post_list.html:
--------------------------------------------------------------------------------
1 | {% extends "main.html" %}
2 |
3 | {% block content %}
4 |
8 |
9 |
10 |
11 | Session data
12 | {{ session }}
13 |
14 | {{ title }}
15 | {{ description }}
16 |
17 |
22 | {% endblock %}
--------------------------------------------------------------------------------
/Django/9-working-with-basic-admin-panel-with-model-in-django/helloworld/posts/templates/set-cookie-page.html:
--------------------------------------------------------------------------------
1 | {% extends "main.html" %}
2 |
3 | {% block content %}
4 | Set cookie pages!
5 | You have set the cookie now
6 |
7 | <- Go back
8 | {% endblock %}
--------------------------------------------------------------------------------
/Django/9-working-with-basic-admin-panel-with-model-in-django/helloworld/posts/templates/set-session-page.html:
--------------------------------------------------------------------------------
1 | {% extends "main.html" %}
2 |
3 | {% block content %}
4 | Set session page
5 | Session now set!
6 |
7 | <- Go back
8 | {% endblock %}
--------------------------------------------------------------------------------
/Django/9-working-with-basic-admin-panel-with-model-in-django/helloworld/posts/tests.py:
--------------------------------------------------------------------------------
1 | from django.test import TestCase
2 |
3 | # Create your tests here.
4 |
--------------------------------------------------------------------------------
/Django/9-working-with-basic-admin-panel-with-model-in-django/helloworld/posts/urls.py:
--------------------------------------------------------------------------------
1 | from django.urls import path, re_path
2 | from . import views
3 | from .views import PostDetail, PostList, PostSetSessionPage
4 |
5 | urlpatterns = [
6 | path('', PostList.as_view(), name='index'),
7 | path('set-cookie-demo', views.set_cookie_demo_page, name='cookie-page'),
8 | path('set-session-demo', PostSetSessionPage.as_view(), name='session-page'),
9 | re_path(r'^(?P\d+)', PostDetail.as_view(), name='post_detail'),
10 | ]
11 |
--------------------------------------------------------------------------------
/Django/9-working-with-basic-admin-panel-with-model-in-django/requirements.txt:
--------------------------------------------------------------------------------
1 | asgiref==3.2.10
2 | Django==3.0.8
3 | django-dotenv==1.4.2
4 | pytz==2020.1
5 | sqlparse==0.3.1
6 |
--------------------------------------------------------------------------------
/Falcon/part-1-and-part-2-basic-rest-api/README.md:
--------------------------------------------------------------------------------
1 | Watch the video for this code its in 2 parts.
2 |
3 | Part 1: https://www.youtube.com/watch?v=W6JvboT8Uo8
4 |
5 | Part 2: https://www.youtube.com/watch?v=vHbdyL9aZ-M
6 |
7 | Subscribe to my Youtube channel here:
8 | https://www.youtube.com/parisnakitakejser
9 |
--------------------------------------------------------------------------------
/Falcon/part-3-rest-api-request-methods/README.md:
--------------------------------------------------------------------------------
1 | Watch this codes tutorial on Youtube:
2 |
3 | Part 3: https://youtu.be/Zx3LmI8tb0A
4 |
--------------------------------------------------------------------------------
/Falcon/part-4-rest-api-json-input-validate-from-client/README.md:
--------------------------------------------------------------------------------
1 | Watch this tutorial on youtube:
2 |
3 | Part 4: https://youtu.be/8vZfEarQC10
4 |
--------------------------------------------------------------------------------
/Flask/10-working-with-http-cross-origin-to-allow-external-request/app.py:
--------------------------------------------------------------------------------
1 | from flask import Flask, Response
2 | from json import dumps
3 | from flask_cors import CORS
4 |
5 | app = Flask(__name__)
6 | CORS(app)
7 | cors = CORS(app, resources={
8 | r"/*": {
9 | "origins": "*"
10 | }
11 | })
12 |
13 |
14 | @app.route('/', methods=['GET'])
15 | def home_page():
16 | return Response(dumps({
17 | 'content': 'Hello world'
18 | }), mimetype='text/json')
19 |
20 |
21 | app.run(port=5000)
22 |
--------------------------------------------------------------------------------
/Flask/10-working-with-http-cross-origin-to-allow-external-request/requirements.txt:
--------------------------------------------------------------------------------
1 | Click==7.0
2 | Flask==1.1.1
3 | itsdangerous==1.1.0
4 | Jinja2==2.10.3
5 | MarkupSafe==1.1.1
6 | Werkzeug==0.16.0
7 |
--------------------------------------------------------------------------------
/Flask/11-basic-web-application-with-flask-and-jinja/app.py:
--------------------------------------------------------------------------------
1 | from flask import Flask, Response
2 | import jinja2
3 |
4 | jinja_env = jinja2.Environment(loader=jinja2.FileSystemLoader('template'))
5 |
6 | app = Flask(__name__)
7 |
8 |
9 | @app.route('/', methods=['GET'])
10 | def home_page():
11 | template = jinja_env.get_template('layout.html')
12 | template_var = {
13 | 'title': 'Jinja test var with flask'
14 | }
15 |
16 | return Response(template.render(template_var), mimetype='text/html'), 200
17 |
18 |
19 | app.run(port=5000)
20 |
--------------------------------------------------------------------------------
/Flask/11-basic-web-application-with-flask-and-jinja/requirements.txt:
--------------------------------------------------------------------------------
1 | Click==7.0
2 | Flask==1.1.1
3 | itsdangerous==1.1.0
4 | Jinja2==2.10.3
5 | MarkupSafe==1.1.1
6 | Werkzeug==0.16.0
7 |
--------------------------------------------------------------------------------
/Flask/12-working-with-middleware-general/app.py:
--------------------------------------------------------------------------------
1 | from flask import Flask, request
2 | from middleware import Middleware
3 |
4 | app = Flask('app')
5 | app.wsgi_app = Middleware(app.wsgi_app)
6 |
7 | @app.route('/', methods=['GET'])
8 | def hello_world():
9 | user = request.environ['user']['name']
10 |
11 | return f'Hi {user}'
12 |
13 | if __name__ == '__main__':
14 | app.run('127.0.0.1', '5000', debug=True)
--------------------------------------------------------------------------------
/Flask/12-working-with-middleware-general/requirements.txt:
--------------------------------------------------------------------------------
1 | Click==7.0
2 | Flask==1.1.1
3 | itsdangerous==1.1.0
4 | Jinja2==2.10.3
5 | MarkupSafe==1.1.1
6 | Werkzeug==0.16.0
7 |
--------------------------------------------------------------------------------
/Flask/13-working-with-middleware-for-specific-route/app.py:
--------------------------------------------------------------------------------
1 | from flask import Flask, g
2 | from middleware import hello_middleware
3 |
4 | app = Flask('app')
5 |
6 |
7 | @app.route('/', methods=['GET'])
8 | @hello_middleware
9 | def hello_world():
10 | return f'token: {g.token}'
11 |
12 |
13 | @app.route('/hello', methods=['GET'])
14 | def hello_world_2():
15 | return 'hello section not hit middleware!'
16 |
17 |
18 | if __name__ == '__main__':
19 | app.run('127.0.0.1', '5000', debug=True)
20 |
--------------------------------------------------------------------------------
/Flask/13-working-with-middleware-for-specific-route/middleware.py:
--------------------------------------------------------------------------------
1 | from functools import wraps
2 | from flask import Response, request, g
3 |
4 |
5 | def hello_middleware(func):
6 | @wraps(func)
7 | def decorated_function(*args, **kwargs):
8 | username = request.authorization['username']
9 | password = request.authorization['password']
10 |
11 | if username == 'TestUser' and password == 'TestPass':
12 | token = 'test token here!'
13 |
14 | g.token = token
15 |
16 | return func(*args, **kwargs)
17 |
18 | return Response('Authorization failed', mimetype='text/plain', status=401)
19 |
20 | return decorated_function
--------------------------------------------------------------------------------
/Flask/13-working-with-middleware-for-specific-route/requirements.txt:
--------------------------------------------------------------------------------
1 | Click==7.0
2 | Flask==1.1.1
3 | itsdangerous==1.1.0
4 | Jinja2==2.10.3
5 | MarkupSafe==1.1.1
6 | Werkzeug==0.16.0
7 |
--------------------------------------------------------------------------------
/Flask/14-use-class-@staticmethod-function-to-manually-routes/app.py:
--------------------------------------------------------------------------------
1 | from flask import Flask
2 | from helloWorld import HelloWorld
3 |
4 | app = Flask('app')
5 | app.add_url_rule('/', view_func=HelloWorld.test_route, methods=['GET'])
6 |
7 | if __name__ == '__main__':
8 | app.run('127.0.0.1', '5000', debug=True)
--------------------------------------------------------------------------------
/Flask/14-use-class-@staticmethod-function-to-manually-routes/helloWorld.py:
--------------------------------------------------------------------------------
1 | class HelloWorld:
2 | @staticmethod
3 | def test_route():
4 | return 'Hello world - custom static route function! :)'
--------------------------------------------------------------------------------
/Flask/14-use-class-@staticmethod-function-to-manually-routes/requirements.txt:
--------------------------------------------------------------------------------
1 | Click==7.0
2 | Flask==1.1.1
3 | itsdangerous==1.1.0
4 | Jinja2==2.10.3
5 | MarkupSafe==1.1.1
6 | Werkzeug==0.16.0
7 |
--------------------------------------------------------------------------------
/Flask/7-print-to-console-with-flask-logger/app.py:
--------------------------------------------------------------------------------
1 | from flask import Flask, Response
2 | import sys
3 | import logging
4 |
5 | logging.basicConfig(level=logging.DEBUG)
6 |
7 | app = Flask(__name__)
8 |
9 |
10 | @app.route('/', methods=['GET'])
11 | def home_page():
12 | print('Hello world - normal')
13 | print('Hello world - sys.stderr', file=sys.stderr)
14 | app.logger.info('Hello world - app.logger.info')
15 |
16 | return Response("test", status=200, mimetype='text/html')
17 |
18 |
19 | app.run(port=5000)
20 |
--------------------------------------------------------------------------------
/Flask/7-print-to-console-with-flask-logger/requirements.txt:
--------------------------------------------------------------------------------
1 | Click==7.0
2 | Flask==1.1.1
3 | itsdangerous==1.1.0
4 | Jinja2==2.10.3
5 | MarkupSafe==1.1.1
6 | Werkzeug==0.16.0
7 |
--------------------------------------------------------------------------------
/Flask/8-email-logging-errors-to-admin/requirements.txt:
--------------------------------------------------------------------------------
1 | Click==7.0
2 | Flask==1.1.1
3 | itsdangerous==1.1.0
4 | Jinja2==2.10.3
5 | MarkupSafe==1.1.1
6 | Werkzeug==0.16.0
7 |
--------------------------------------------------------------------------------
/Flask/9-change-http-status-code-on-the-fly/app.py:
--------------------------------------------------------------------------------
1 | from flask import Flask, Response, request
2 |
3 | app = Flask(__name__)
4 |
5 |
6 | @app.route('/auth', methods=['GET'])
7 | def auth_page():
8 | status_code = int(request.args.get('status', 200))
9 | return Response("Auth - user not allow", mimetype='text/html'), status_code
10 |
11 |
12 | @app.route('/', methods=['GET'])
13 | def home_page():
14 | return Response("Hello world", mimetype='text/html'), 200
15 |
16 |
17 | app.run(port=5000)
18 |
--------------------------------------------------------------------------------
/Flask/9-change-http-status-code-on-the-fly/requirements.txt:
--------------------------------------------------------------------------------
1 | Click==7.0
2 | Flask==1.1.1
3 | itsdangerous==1.1.0
4 | Jinja2==2.10.3
5 | MarkupSafe==1.1.1
6 | Werkzeug==0.16.0
7 |
--------------------------------------------------------------------------------
/Flask/how-to-use-prometheus-flask-exporter/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM python:3.9-slim-buster
2 |
3 | COPY . .
4 |
5 | RUN pip install -r requirements.txt
6 |
7 | EXPOSE 5001
8 |
9 | ENTRYPOINT [ "python", "app.py" ]
--------------------------------------------------------------------------------
/Flask/how-to-use-prometheus-flask-exporter/app.py:
--------------------------------------------------------------------------------
1 | from flask import Flask, request
2 | from prometheus_flask_exporter import PrometheusMetrics
3 |
4 | app = Flask(__name__)
5 | metrics = PrometheusMetrics(app)
6 |
7 | @app.route('/simple')
8 | def simple_get():
9 | return {
10 | 'status': '200'
11 | }
12 |
13 | app.run(host='0.0.0.0', port=5001)
--------------------------------------------------------------------------------
/Flask/how-to-use-prometheus-flask-exporter/deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | name: flask-demo-deployment
5 | labels:
6 | app: flask
7 | spec:
8 | replicas: 1
9 | selector:
10 | matchLabels:
11 | app: flask
12 | template:
13 | metadata:
14 | labels:
15 | app: flask
16 | annotations:
17 | prometheus.io/scrape: "true"
18 | prometheus.io.scheme: "http"
19 | prometheus.io/path: "/metrics"
20 | prometheus.io/port: "5001"
21 | spec:
22 | containers:
23 | - name: flask
24 | image: pnk/flask-demo
25 | imagePullPolicy: Never
26 | ports:
27 | - containerPort: 5001
--------------------------------------------------------------------------------
/Flask/how-to-use-prometheus-flask-exporter/requirements.txt:
--------------------------------------------------------------------------------
1 | prometheus-flask-exporter
2 | Flask
--------------------------------------------------------------------------------
/Jinja/1-basic-jinja-application/app.py:
--------------------------------------------------------------------------------
1 | from jinja2 import Template
2 |
3 | template = Template('Hello {{ name }}')
4 | template_render = template.render(name='Paris')
5 |
6 | print(template_render)
--------------------------------------------------------------------------------
/Jinja/1-basic-jinja-application/requirements.txt:
--------------------------------------------------------------------------------
1 | Jinja2==2.10.3
2 | MarkupSafe==1.1.1
3 |
--------------------------------------------------------------------------------
/Jinja/2-use-externel-html-files-with-jinja/requirements.txt:
--------------------------------------------------------------------------------
1 | Jinja2==2.10.3
2 | MarkupSafe==1.1.1
3 |
--------------------------------------------------------------------------------
/Jinja/2-use-externel-html-files-with-jinja/use-jinja-environment.py:
--------------------------------------------------------------------------------
1 | import jinja2
2 |
3 | jinja_env = jinja2.Environment(loader=jinja2.FileSystemLoader('template'))
4 | template = jinja_env.get_template('layout.html')
5 |
6 | print(template.render())
--------------------------------------------------------------------------------
/Jinja/2-use-externel-html-files-with-jinja/use-open-command.py:
--------------------------------------------------------------------------------
1 | from jinja2 import Template
2 |
3 | with open('template/layout.html') as file:
4 | template = Template(file.read())
5 |
6 | print(template.render())
--------------------------------------------------------------------------------
/Jinja/3-extends-html-files-to-work-with-multi-html-files/app.py:
--------------------------------------------------------------------------------
1 | import jinja2
2 | import os
3 |
4 | jinja_env = jinja2.Environment(loader=jinja2.FileSystemLoader('template'))
5 |
6 | jinja_var = {
7 | 'title': 'this is a test content page'
8 | }
9 |
10 | template = jinja_env.get_template('content.html')
11 | print(template.render(jinja_var))
--------------------------------------------------------------------------------
/Jinja/3-extends-html-files-to-work-with-multi-html-files/requirements.txt:
--------------------------------------------------------------------------------
1 | Jinja2==2.10.3
2 | MarkupSafe==1.1.1
3 |
--------------------------------------------------------------------------------
/Jinja/3-extends-html-files-to-work-with-multi-html-files/template/content.html:
--------------------------------------------------------------------------------
1 | {% extends "layout.html" %}
2 |
3 | {% block content %}
4 | Content pages
5 |
6 | Content test page
7 |
8 | {% endblock %}
--------------------------------------------------------------------------------
/Jinja/3-extends-html-files-to-work-with-multi-html-files/template/layout.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {{ title }}
6 |
7 |
8 |
9 | {% block content %}
10 | missing content include
11 | {% endblock %}
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Jinja/4-working-with-loops/loop-list-with-dict.py:
--------------------------------------------------------------------------------
1 | import jinja2
2 |
3 | jinja_env = jinja2.Environment(loader=jinja2.FileSystemLoader('template'))
4 |
5 | jinja_var = {
6 | 'employes': [{
7 | 'name': 'Paris',
8 | 'office': 'Denmark'
9 | }, {
10 | 'name': 'Bob',
11 | 'office': 'Germany'
12 | }]
13 | }
14 |
15 | template = jinja_env.get_template('layout2.html')
16 | print(template.render(jinja_var))
--------------------------------------------------------------------------------
/Jinja/4-working-with-loops/loop-list-with-string.py:
--------------------------------------------------------------------------------
1 | import jinja2
2 |
3 | jinja_env = jinja2.Environment(loader=jinja2.FileSystemLoader('template'))
4 |
5 | jinja_var = {
6 | 'users': ['User 1', 'User 2', 'User 3']
7 | }
8 |
9 | template = jinja_env.get_template('layout.html')
10 | print(template.render(jinja_var))
--------------------------------------------------------------------------------
/Jinja/4-working-with-loops/requirements.txt:
--------------------------------------------------------------------------------
1 | Jinja2==2.10.3
2 | MarkupSafe==1.1.1
3 |
--------------------------------------------------------------------------------
/Jinja/4-working-with-loops/template/layout.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Title
6 |
7 |
8 |
9 |
10 | {% for user in users %}
11 | - {{user}}
12 | {% endfor %}
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Jinja/4-working-with-loops/template/layout2.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Title
6 |
7 |
8 |
9 |
10 | {% for employe in employes %}
11 | - {{employe.name}}: {{employe.office}}
12 | {% endfor %}
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Jinja/5-working-with-conditional/app.py:
--------------------------------------------------------------------------------
1 | import jinja2
2 |
3 | jinja_env = jinja2.Environment(loader=jinja2.FileSystemLoader('template'))
4 | jinja_var = {
5 | 'city': 'copenhagen'
6 | }
7 |
8 | template = jinja_env.get_template('layout.html')
9 | print(template.render(jinja_var))
--------------------------------------------------------------------------------
/Jinja/5-working-with-conditional/requirements.txt:
--------------------------------------------------------------------------------
1 | Jinja2==2.10.3
2 | MarkupSafe==1.1.1
3 |
--------------------------------------------------------------------------------
/Jinja/5-working-with-conditional/template/layout.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Title
6 |
7 |
8 |
9 | {% if city == 'copenhagen' %}
10 | Visit Copenhagen
11 | {% elif city == 'aarhus' %}
12 | Visit Aarhus? Why try Copenhagen
13 | {% else %}
14 | Don't understand the city you visit!
15 | {% endif %}
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Kafka/README.md:
--------------------------------------------------------------------------------
1 | # Kafka Data Stream
2 |
3 | You can with this folder starting up a fully working Kafka cluster on your machine using docker-compose.yaml file, all the files you can test with are placed into the sample folder.
4 |
5 | ## Start Kafka Cluster
6 |
7 | It's will start up a Kafka single node cluster, Zookeeper, Kafka UI and Kafka Connect single node Cluster there will be ready to work with locally.
8 |
9 | ```
10 | docker-compose up -d
11 | ```
12 |
13 | ## Sample files
14 |
15 | ```
16 | cd sample
17 | pyenv virtualenv kafka-test
18 | pyenv local kafka-test
19 | pip install -r requirements.txt
20 | ```
21 |
--------------------------------------------------------------------------------
/Kafka/kui/config.yml:
--------------------------------------------------------------------------------
1 | auth:
2 | type: DISABLED
3 | kafka:
4 | clusters:
5 | - bootstrapServers: kafka:9092
6 | kafkaConnect:
7 | - address: http://kafka-connect:8083
8 | name: kafka-connect
9 | name: kafka docker
10 | properties: {}
11 | readOnly: false
12 | rbac:
13 | roles: []
14 | webclient: {}
15 |
--------------------------------------------------------------------------------
/Kafka/sample/booking.avsc:
--------------------------------------------------------------------------------
1 | {
2 | "type": "record",
3 | "doc": "Hotel booking events",
4 | "name": "HotelBooking",
5 | "fields": [
6 | { "name": "name", "type": "string", "doc": "Customer name" },
7 | { "name": "hotel", "type": "string", "doc": "Hotel name" },
8 | { "name": "details", "type": "string", "doc": "Note from customer" },
9 | {
10 | "name": "dateFrom",
11 | "type": "string",
12 | "doc": "Booking from date"
13 | },
14 | {
15 | "name": "dateTo",
16 | "type": "string",
17 | "doc": "Booking to date"
18 | }
19 | ]
20 | }
21 |
--------------------------------------------------------------------------------
/Kafka/sample/consuming-avro.py:
--------------------------------------------------------------------------------
1 | from kafka import KafkaConsumer
2 | import io
3 | import avro.schema
4 | import avro.io
5 |
6 | from settings import AVRO_SCHEMA_FILE, BOOTSTRAP_SERVERS, TOPIC_NAME
7 |
8 | schema = avro.schema.parse(open(AVRO_SCHEMA_FILE).read())
9 |
10 | # To consume messages
11 | consumer = KafkaConsumer(
12 | TOPIC_NAME,
13 | group_id='my_group',
14 | bootstrap_servers=BOOTSTRAP_SERVERS,
15 | )
16 |
17 | for msg in consumer:
18 | bytes_reader = io.BytesIO(msg.value)
19 | decoder = avro.io.BinaryDecoder(bytes_reader)
20 | reader = avro.io.DatumReader(schema)
21 | booking = reader.read(decoder)
22 | print(booking)
23 |
--------------------------------------------------------------------------------
/Kafka/sample/consuming.py:
--------------------------------------------------------------------------------
1 | from kafka import KafkaConsumer
2 | import json
3 |
4 | consumer = KafkaConsumer(
5 | bootstrap_servers='localhost:9092',
6 | security_protocol="PLAINTEXT",
7 | value_deserializer=lambda v: json.loads(v.decode('ascii')),
8 | # auto_offset_reset='earliest'
9 | )
10 |
11 | consumer.subscribe(topics='hotel-booking-request')
12 |
13 | for message in consumer:
14 | print(f"{message.partition}:{message.offset} v={message.value}")
15 |
--------------------------------------------------------------------------------
/Kafka/sample/producer.py:
--------------------------------------------------------------------------------
1 | from kafka import KafkaProducer
2 | import json
3 |
4 | producer = KafkaProducer(
5 | bootstrap_servers='localhost:29092',
6 | security_protocol="PLAINTEXT",
7 | value_serializer=lambda v: json.dumps(v).encode('ascii')
8 | )
9 |
10 | producer.send(
11 | 'hotel-booking-request',
12 | value={
13 | "name": "Evy Lina",
14 | "hotel": "Cheap Hotel",
15 | "dateFrom": "14-07-2024",
16 | "dateTo": "01-08-2021",
17 | "details": "Wish coffee ready 😀"
18 | }
19 | )
20 | producer.flush()
21 |
--------------------------------------------------------------------------------
/Kafka/sample/requirements.txt:
--------------------------------------------------------------------------------
1 | kafka-python==2.0.2
2 | avro==1.11.3
3 | boto3
--------------------------------------------------------------------------------
/Kafka/sample/settings.py:
--------------------------------------------------------------------------------
1 | # Kafka
2 | TOPIC_NAME = 'hotel-booking-request'
3 | BOOTSTRAP_SERVERS = ['localhost:29092']
4 | # AVRO
5 | AVRO_SCHEMA_FILE = 'booking.avsc'
6 |
7 | # AWS GLUE settings
8 | GLUE_STREAM_SCHEMA_REGISTRY = 'my-first-glue-registry'
9 | GLUE_SCHEMA = 'my-schema-name'
10 |
--------------------------------------------------------------------------------
/LocalStack/how-you-can-test-your-aws-cloud-infrastructure-locally-with-pytest-and-localstack-inside-a-docker-containers/.deployment/unittest/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM python:3.9-buster
2 |
3 | WORKDIR /app
4 |
5 | COPY requirements.txt ./
6 | RUN pip install --no-cache-dir -r requirements.txt
7 |
8 | COPY . .
9 |
10 | RUN touch tests/.env
11 | RUN rm -rf tests/.env
12 | RUN mv tests/.env-test tests/.env
13 |
14 | CMD [ "pytest" ]
--------------------------------------------------------------------------------
/LocalStack/how-you-can-test-your-aws-cloud-infrastructure-locally-with-pytest-and-localstack-inside-a-docker-containers/app.py:
--------------------------------------------------------------------------------
1 | from aws_cdk import App
2 |
3 | from stacks.testStack import TestStack
4 |
5 | app = App()
6 | TestStack(app, "TestStack")
7 | app.synth()
8 |
--------------------------------------------------------------------------------
/LocalStack/how-you-can-test-your-aws-cloud-infrastructure-locally-with-pytest-and-localstack-inside-a-docker-containers/cdk.json:
--------------------------------------------------------------------------------
1 | {
2 | "app": "python3 app.py"
3 | }
--------------------------------------------------------------------------------
/LocalStack/how-you-can-test-your-aws-cloud-infrastructure-locally-with-pytest-and-localstack-inside-a-docker-containers/requirements.txt:
--------------------------------------------------------------------------------
1 | boto3
2 | pytest
3 | black
4 | flake8
5 | python-dotenv
--------------------------------------------------------------------------------
/LocalStack/how-you-can-test-your-aws-cloud-infrastructure-locally-with-pytest-and-localstack-inside-a-docker-containers/stacks/lambda_assets/test_fn/lambda_handler.py:
--------------------------------------------------------------------------------
1 | from helloWorld import respHello
2 |
3 |
4 | def handler(event, context):
5 | return {
6 | "status": "success",
7 | "response": respHello(name="test-unit"),
8 | "event": event,
9 | }
10 |
--------------------------------------------------------------------------------
/LocalStack/how-you-can-test-your-aws-cloud-infrastructure-locally-with-pytest-and-localstack-inside-a-docker-containers/stacks/lambda_layers/test_layer/python/lib/python3.9/site-packages/helloWorld/__init__.py:
--------------------------------------------------------------------------------
1 | def respHello(name: str) -> dict:
2 | return {
3 | "name": name,
4 | }
5 |
--------------------------------------------------------------------------------
/LocalStack/how-you-can-test-your-aws-cloud-infrastructure-locally-with-pytest-and-localstack-inside-a-docker-containers/tests/.env-test:
--------------------------------------------------------------------------------
1 | AWS_ACCESS_KEY_ID=test
2 | AWS_SECRET_ACCESS_KEY=test
3 | AWS_DEFAULT_REGION=eu-central-1
4 | AWS_ENDPOINT_URL=http://localstack:4566
5 |
--------------------------------------------------------------------------------
/LocalStack/how-you-can-test-your-aws-cloud-infrastructure-locally-with-pytest-and-localstack-inside-a-docker-containers/tests/conftest.py:
--------------------------------------------------------------------------------
1 | from dotenv import load_dotenv
2 |
3 | load_dotenv()
4 |
--------------------------------------------------------------------------------
/LocalStack/how-you-can-test-your-aws-cloud-infrastructure-locally-with-pytest-and-localstack-inside-a-docker-containers/tests/functional/test_lambda.py:
--------------------------------------------------------------------------------
1 | import logging
2 | import json
3 |
4 | from utils.aws.lambda_ import MockLambda
5 |
6 |
7 | class TestLambda_Invokes:
8 | fn_name = "test-lambda-fn"
9 |
10 | @classmethod
11 | def setup_class(cls):
12 | logging.info("setup_class")
13 |
14 | @classmethod
15 | def teardown_class(cls):
16 | logging.info("teardown_class")
17 |
18 | def test_lambda_invoke(self):
19 | resp = MockLambda.invoke(
20 | function_name=self.fn_name, payload={"demo": "a", "testing": "b"}
21 | )
22 | print(json.loads(resp["Payload"].read()))
23 | assert 1 != 1
24 |
--------------------------------------------------------------------------------
/LocalStack/how-you-can-test-your-aws-cloud-infrastructure-locally-with-pytest-and-localstack-inside-a-docker-containers/tests/functional/test_s3.py:
--------------------------------------------------------------------------------
1 | import logging
2 | from utils.aws.s3 import MockS3
3 |
4 |
5 | class TestS3_Buckets:
6 | bucket_name = "demo-bucket"
7 |
8 | @classmethod
9 | def setup_class(cls):
10 | logging.info("setup_class")
11 |
12 | MockS3.createBucket(cls.bucket_name)
13 |
14 | @classmethod
15 | def teardown_class(cls):
16 | logging.info("teardown_class")
17 | MockS3.garbageCollection(cls.bucket_name)
18 |
19 | def test_sqs_insert(self):
20 | assert 1 != 1
21 |
--------------------------------------------------------------------------------
/LocalStack/how-you-can-test-your-aws-cloud-infrastructure-locally-with-pytest-and-localstack-inside-a-docker-containers/tests/pytest.ini:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/LocalStack/how-you-can-test-your-aws-cloud-infrastructure-locally-with-pytest-and-localstack-inside-a-docker-containers/tests/pytest.ini
--------------------------------------------------------------------------------
/LocalStack/how-you-can-test-your-aws-cloud-infrastructure-locally-with-pytest-and-localstack-inside-a-docker-containers/tests/utils/aws/lambda_.py:
--------------------------------------------------------------------------------
1 | import boto3
2 | import os
3 | from json import dumps
4 |
5 | lambda_client = boto3.client(
6 | "lambda",
7 | endpoint_url=os.getenv("AWS_ENDPOINT_URL"),
8 | )
9 |
10 |
11 | class MockLambda:
12 | @staticmethod
13 | def invoke(function_name: str, payload: dict = {}):
14 | response = lambda_client.invoke(
15 | FunctionName=function_name,
16 | # InvocationType="Event" | "RequestResponse" | "DryRun",
17 | # LogType="None" | "Tail",
18 | # ClientContext="string",
19 | Payload=dumps(payload),
20 | # Qualifier="string",
21 | )
22 |
23 | return response
24 |
--------------------------------------------------------------------------------
/Milvus/enable-and-create-auth-user-in-milvus/sample-code/.env:
--------------------------------------------------------------------------------
1 | MILVUS_HOST={host-url}
2 | MILVUS_PORT=19530
3 | MILVUS_USER=root
4 | MILVUS_PASS=Milvus
--------------------------------------------------------------------------------
/Milvus/enable-and-create-auth-user-in-milvus/sample-code/create-user.py:
--------------------------------------------------------------------------------
1 | import os
2 | from dotenv import load_dotenv
3 | from pymilvus import utility, connections
4 |
5 | load_dotenv()
6 |
7 | ## connect to milvus
8 | connections.connect(
9 | alias='default',
10 | host=os.getenv('MILVUS_HOST'),
11 | port=os.getenv('MILVUS_PORT'),
12 | user=os.getenv('MILVUS_USER'),
13 | password=os.getenv('MILVUS_PASS'),
14 | )
15 |
16 | users = utility.create_user('testuser', '123456', using='default')
17 |
18 | print(users)
--------------------------------------------------------------------------------
/Milvus/enable-and-create-auth-user-in-milvus/sample-code/delete-user.py:
--------------------------------------------------------------------------------
1 | import os
2 | from dotenv import load_dotenv
3 | from pymilvus import utility, connections
4 |
5 | load_dotenv()
6 |
7 | ## connect to milvus
8 | connections.connect(
9 | alias='default',
10 | host=os.getenv('MILVUS_HOST'),
11 | port=os.getenv('MILVUS_PORT'),
12 | user=os.getenv('MILVUS_USER'),
13 | password=os.getenv('MILVUS_PASS'),
14 | )
15 |
16 | users = utility.delete_user('testuser', using='default')
17 |
18 | print(users)
--------------------------------------------------------------------------------
/Milvus/enable-and-create-auth-user-in-milvus/sample-code/list-user.py:
--------------------------------------------------------------------------------
1 | import os
2 | from dotenv import load_dotenv
3 | from pymilvus import utility, connections
4 |
5 | load_dotenv()
6 |
7 | ## connect to milvus
8 | ## connect to milvus
9 | connections.connect(
10 | alias='default',
11 | host=os.getenv('MILVUS_HOST'),
12 | port=os.getenv('MILVUS_PORT'),
13 | user=os.getenv('MILVUS_USER'),
14 | password=os.getenv('MILVUS_PASS'),
15 | )
16 |
17 | users = utility.list_usernames(using='default')
18 |
19 | print(users)
--------------------------------------------------------------------------------
/Milvus/enable-and-create-auth-user-in-milvus/sample-code/requirements.txt:
--------------------------------------------------------------------------------
1 | pymilvus==2.2.2
2 | python-dotenv==0.21.1
--------------------------------------------------------------------------------
/Milvus/enable-and-create-auth-user-in-milvus/sample-code/reset-password.py:
--------------------------------------------------------------------------------
1 | import os
2 | from dotenv import load_dotenv
3 | from pymilvus import utility, connections
4 |
5 | load_dotenv()
6 |
7 | ## connect to milvus
8 | connections.connect(
9 | alias='default',
10 | host=os.getenv('MILVUS_HOST'),
11 | port=os.getenv('MILVUS_PORT'),
12 | user=os.getenv('MILVUS_USER'),
13 | password=os.getenv('MILVUS_PASS'),
14 | )
15 |
16 | users = utility.reset_password('user', 'old_password', 'new_password', using='default')
17 |
18 | print(users)
--------------------------------------------------------------------------------
/Milvus/enable-and-create-auth-user-in-milvus/update-milvus.sh:
--------------------------------------------------------------------------------
1 | helm upgrade milvus milvus/milvus --reuse-values -f values.yaml
2 |
--------------------------------------------------------------------------------
/Milvus/enable-and-create-auth-user-in-milvus/values.yaml:
--------------------------------------------------------------------------------
1 | extraConfigFiles:
2 | user.yaml: |+
3 | common:
4 | security:
5 | authorizationEnabled: true
6 |
7 | authorization:
8 | enabled: true
--------------------------------------------------------------------------------
/Milvus/run-milvus-on-aws-eks-in-cluster-mode/deploy-milvus.sh:
--------------------------------------------------------------------------------
1 | eksctl create cluster -f eks-cluster.yml
2 | aws eks --region eu-west-1 update-kubeconfig --name eks-cluster
3 | helm repo add milvus https://milvus-io.github.io/milvus-helm/
4 | helm upgrade --install --set cluster.enabled=true --set externalS3.enabled=true --set externalS3.host='s3.eu-west-1.amazonaws.com' --set externalS3.port=80 --set externalS3.accessKey={access-key} --set externalS3.secretKey={secret-key} --set externalS3.bucketName=milvus-data-{region}-{account-id} --set minio.enabled=False --set service.type=LoadBalancer milvus milvus/milvus
--------------------------------------------------------------------------------
/Milvus/run-milvus-on-aws-eks-in-cluster-mode/eks-cluster.yml:
--------------------------------------------------------------------------------
1 | apiVersion: eksctl.io/v1alpha5
2 | kind: ClusterConfig
3 | metadata:
4 | name: eks-cluster
5 | region: eu-west-1
6 |
7 | nodeGroups:
8 | - name: ng-databases
9 | labels: { role: databases }
10 | instanceType: m6i.4xlarge
11 | desiredCapacity: 3
12 | volumeSize: 80
13 | iam:
14 | withAddonPolicies:
15 | ebs: true
16 |
17 | addons:
18 | - name: aws-ebs-csi-driver
19 | - name: vpc-cni
20 | - name: coredns
21 | - name: kube-proxy
--------------------------------------------------------------------------------
/Milvus/run-milvus-on-aws-eks-in-cluster-mode/sample-code/.env:
--------------------------------------------------------------------------------
1 | MILVUS_HOST={host-url}
2 | MILVUS_PORT=19530
--------------------------------------------------------------------------------
/Milvus/run-milvus-on-aws-eks-in-cluster-mode/sample-code/insert-data.py:
--------------------------------------------------------------------------------
1 | import random
2 | import os
3 | from dotenv import load_dotenv
4 | from pymilvus import Collection, connections
5 |
6 | load_dotenv()
7 |
8 | ## connect to milvus
9 | connections.connect(host=os.getenv('MILVUS_HOST'), port=os.getenv('MILVUS_PORT'))
10 |
11 | # Parepare data
12 | data = [
13 | [i for i in range(2000)],
14 | [i for i in range(10000, 12000)],
15 | [[random.random() for _ in range(2)] for _ in range(2000)],
16 | ]
17 |
18 | # Get an existing collection.
19 | collection = Collection("book")
20 | mr = collection.insert(data)
--------------------------------------------------------------------------------
/Milvus/run-milvus-on-aws-eks-in-cluster-mode/sample-code/requirements.txt:
--------------------------------------------------------------------------------
1 | pymilvus==2.2.2
2 | python-dotenv==0.21.1
--------------------------------------------------------------------------------
/Milvus/run-milvus-on-aws-eks-in-cluster-mode/sample-code/search.py:
--------------------------------------------------------------------------------
1 | import os
2 | from dotenv import load_dotenv
3 | from pymilvus import Collection, connections
4 |
5 | load_dotenv()
6 |
7 | ## connect to milvus
8 | connections.connect(host=os.getenv('MILVUS_HOST'), port=os.getenv('MILVUS_PORT'))
9 | # Get an existing collection.
10 | collection = Collection("book")
11 | # Vector search
12 | search_params = {"metric_type": "L2", "params": {"nprobe": 10}}
13 | results = collection.search(
14 | data=[[0.1, 0.2]],
15 | anns_field="book_intro",
16 | param=search_params,
17 | limit=10,
18 | expr=None
19 | )
20 |
21 | print(results)
--------------------------------------------------------------------------------
/Milvus/scale-out-milvus-with-multi-query-nodes/sample-code/.env:
--------------------------------------------------------------------------------
1 | MILVUS_HOST={host-url}
2 | MILVUS_PORT=19530
--------------------------------------------------------------------------------
/Milvus/scale-out-milvus-with-multi-query-nodes/sample-code/requirements.txt:
--------------------------------------------------------------------------------
1 | pymilvus==2.2.2
2 | python-dotenv==0.21.1
--------------------------------------------------------------------------------
/Milvus/scale-out-milvus-with-multi-query-nodes/scale-out.sh:
--------------------------------------------------------------------------------
1 | helm upgrade milvus milvus/milvus --set queryNode.replicas=3 --reuse-values
--------------------------------------------------------------------------------
/Poetry/my-first-project/README.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Poetry/my-first-project/README.md
--------------------------------------------------------------------------------
/Poetry/my-first-project/pyproject.toml:
--------------------------------------------------------------------------------
1 | [tool.poetry]
2 | name = "my-first-project"
3 | version = "0.1.0"
4 | description = ""
5 | authors = ["Paris Nakita Kejser "]
6 | readme = "README.md"
7 | package-mode = false
8 |
9 | [tool.poetry.dependencies]
10 | python = "^3.12"
11 | fastapi = "^0.111.0"
12 |
13 |
14 | [build-system]
15 | requires = ["poetry-core"]
16 | build-backend = "poetry.core.masonry.api"
17 |
18 | [tool.pytest.ini_options]
19 | pythonpath = "src"
20 |
--------------------------------------------------------------------------------
/Poetry/my-first-project/src/model/__init__.py:
--------------------------------------------------------------------------------
1 | def my_func():
2 | return True
3 |
--------------------------------------------------------------------------------
/Poetry/my-first-project/tests/test_my_func.py:
--------------------------------------------------------------------------------
1 | from model import my_func
2 |
3 |
4 | def test_my_func_return_true():
5 | assert my_func() is True
6 |
--------------------------------------------------------------------------------
/Unittest/1-basic-unittest-in-python/Library/Company.py:
--------------------------------------------------------------------------------
1 | def get_country(iso_code=None):
2 | country_dict = {
3 | 'DK': {
4 | 'name': 'Denmark'
5 | },
6 | 'DE': {
7 | 'name': 'Germany'
8 | },
9 | 'UK': {
10 | 'name': 'United Kingdom'
11 | },
12 | 'SE': {
13 | 'name': 'Sweden'
14 | },
15 | 'NO': {
16 | 'name': 'Norway'
17 | }
18 | }
19 |
20 | if type(iso_code) != str:
21 | raise TypeError('iso_code need to be a string')
22 | elif len(iso_code) != 2:
23 | raise ValueError('iso_code need to be 2 characters long')
24 |
25 | if iso_code in country_dict:
26 | return True, country_dict[iso_code]
27 | else:
28 | return False, None
29 |
--------------------------------------------------------------------------------
/Unittest/1-basic-unittest-in-python/Library/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Unittest/1-basic-unittest-in-python/Library/__init__.py
--------------------------------------------------------------------------------
/Unittest/2-how-to-use-setUp-and-tearDown-in-unittest/code-finished/Unittest/TestLibraryPerson.py:
--------------------------------------------------------------------------------
1 | import unittest
2 |
3 | from library.person import Person
4 |
5 |
6 | class TestAllowedToBuyAlcohol(unittest.TestCase):
7 | def setUp(self) -> None:
8 | self.__person = Person()
9 |
10 | def tearDown(self) -> None:
11 | del self.__person
12 |
13 | def test_age_are_to_low_to_buy(self):
14 | self.assertEqual(True, self.__person.allowed_to_buy_alcohol('', 4.6))
15 |
16 | def test_age_its_allowed_to_buy(self):
17 | self.assertEqual(True, self.__person.allowed_to_buy_alcohol('', 46.6))
18 |
19 |
20 | if __name__ == '__main__':
21 | unittest.main()
22 |
--------------------------------------------------------------------------------
/Unittest/2-how-to-use-setUp-and-tearDown-in-unittest/code-finished/library/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Unittest/2-how-to-use-setUp-and-tearDown-in-unittest/code-finished/library/__init__.py
--------------------------------------------------------------------------------
/Unittest/2-how-to-use-setUp-and-tearDown-in-unittest/code-finished/library/person.py:
--------------------------------------------------------------------------------
1 | class Person:
2 | def allowed_to_buy_alcohol(self, birthday, alcohol_percentage):
3 | # age 16-18: < 16.5%
4 | # age 18 and over: > 16.5%
5 | pass
6 |
7 | def allowed_to_buy_tobacco(self, birthday):
8 | # age 18 and over
9 | pass
10 |
--------------------------------------------------------------------------------
/Unittest/2-how-to-use-setUp-and-tearDown-in-unittest/code-start/Unittest/TestLibraryPerson.py:
--------------------------------------------------------------------------------
1 | import unittest
2 |
3 | from library.person import Person
4 |
5 |
6 | class TestAllowedToBuyAlcohol(unittest.TestCase):
7 | def test_age_are_to_low_to_buy(self):
8 | self.assertEqual(True, False)
9 |
10 | def test_age_its_allowed_to_buy(self):
11 | self.assertEqual(True, False)
12 |
13 |
14 | if __name__ == '__main__':
15 | unittest.main()
16 |
--------------------------------------------------------------------------------
/Unittest/2-how-to-use-setUp-and-tearDown-in-unittest/code-start/library/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Unittest/2-how-to-use-setUp-and-tearDown-in-unittest/code-start/library/__init__.py
--------------------------------------------------------------------------------
/Unittest/2-how-to-use-setUp-and-tearDown-in-unittest/code-start/library/person.py:
--------------------------------------------------------------------------------
1 | class Person:
2 | def allowed_to_buy_alcohol(self, birthday, alcohol_percentage):
3 | # age 16-18: < 16.5%
4 | # age 18 and over: > 16.5%
5 | pass
6 |
7 | def allowed_to_buy_tobacco(self, birthday):
8 | # age 18 and over
9 | pass
10 |
--------------------------------------------------------------------------------
/Unittest/3-create-faster-unittest-with-functions/code-finished/library/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Unittest/3-create-faster-unittest-with-functions/code-finished/library/__init__.py
--------------------------------------------------------------------------------
/Unittest/3-create-faster-unittest-with-functions/code-finished/library/person.py:
--------------------------------------------------------------------------------
1 | class Person:
2 | def allowed_to_buy_alcohol(self, birthday, alcohol_percentage):
3 | # age 16-18: < 16.5%
4 | # age 18 and over: > 16.5%
5 | print('birthday', birthday)
6 | print('alcohol_percentage', alcohol_percentage)
7 |
8 | def allowed_to_buy_tobacco(self, birthday):
9 | # age 18 and over
10 | pass
11 |
--------------------------------------------------------------------------------
/Unittest/3-create-faster-unittest-with-functions/code-start/Unittest/TestLibraryPerson.py:
--------------------------------------------------------------------------------
1 | import unittest
2 |
3 | from library.person import Person
4 |
5 |
6 | class TestAllowedToBuyAlcohol(unittest.TestCase):
7 | def setUp(self) -> None:
8 | self.__person = Person()
9 |
10 | def tearDown(self) -> None:
11 | del self.__person
12 |
13 | def test_age_are_to_low_to_buy(self):
14 | self.assertEqual(True, self.__person.allowed_to_buy_alcohol('', 4.6))
15 |
16 | def test_age_its_allowed_to_buy(self):
17 | self.assertEqual(True, self.__person.allowed_to_buy_alcohol('', 46.6))
18 |
19 |
20 | if __name__ == '__main__':
21 | unittest.main()
22 |
--------------------------------------------------------------------------------
/Unittest/3-create-faster-unittest-with-functions/code-start/library/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Unittest/3-create-faster-unittest-with-functions/code-start/library/__init__.py
--------------------------------------------------------------------------------
/Unittest/3-create-faster-unittest-with-functions/code-start/library/person.py:
--------------------------------------------------------------------------------
1 | class Person:
2 | def allowed_to_buy_alcohol(self, birthday, alcohol_percentage):
3 | # age 16-18: < 16.5%
4 | # age 18 and over: > 16.5%
5 | pass
6 |
7 | def allowed_to_buy_tobacco(self, birthday):
8 | # age 18 and over
9 | pass
10 |
--------------------------------------------------------------------------------
/Unittest/4-how-to-success-passed-your-test-cases/code-finished/library/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Unittest/4-how-to-success-passed-your-test-cases/code-finished/library/__init__.py
--------------------------------------------------------------------------------
/Unittest/4-how-to-success-passed-your-test-cases/code-start/library/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Unittest/4-how-to-success-passed-your-test-cases/code-start/library/__init__.py
--------------------------------------------------------------------------------
/Unittest/4-how-to-success-passed-your-test-cases/code-start/library/person.py:
--------------------------------------------------------------------------------
1 | class Person:
2 | def allowed_to_buy_alcohol(self, birthday, alcohol_percentage):
3 | # age 16-18: < 16.5%
4 | # age 18 and over: > 16.5%
5 | print('birthday', birthday)
6 | print('alcohol_percentage', alcohol_percentage)
7 |
8 | def allowed_to_buy_tobacco(self, birthday):
9 | # age 18 and over
10 | pass
11 |
--------------------------------------------------------------------------------
/Unittest/5-use-custom-assert-in-your-unittest-test-cases/code-finished/library/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Unittest/5-use-custom-assert-in-your-unittest-test-cases/code-finished/library/__init__.py
--------------------------------------------------------------------------------
/Unittest/5-use-custom-assert-in-your-unittest-test-cases/code-finished/library/alcohol.py:
--------------------------------------------------------------------------------
1 | class Alcohol:
2 | @staticmethod
3 | def calc_unit(cl, percentage):
4 | return round((cl * percentage) / (100 * 1.5), 2)
5 |
6 | @staticmethod
7 | def unit_to_gram(units):
8 | return round(units * 12)
--------------------------------------------------------------------------------
/Unittest/5-use-custom-assert-in-your-unittest-test-cases/code-start/library/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Unittest/5-use-custom-assert-in-your-unittest-test-cases/code-start/library/__init__.py
--------------------------------------------------------------------------------
/Unittest/6-how-to-catch-a-raise-error/code-finished/library/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Unittest/6-how-to-catch-a-raise-error/code-finished/library/__init__.py
--------------------------------------------------------------------------------
/Unittest/6-how-to-catch-a-raise-error/code-finished/library/alcohol.py:
--------------------------------------------------------------------------------
1 | class Alcohol:
2 | @staticmethod
3 | def calc_unit(cl, percentage):
4 | if not isinstance(percentage, int) and not isinstance(percentage, float):
5 | raise ValueError
6 | elif not isinstance(cl, int) and not isinstance(cl, float):
7 | raise ValueError
8 | elif percentage > 100 or percentage < 0:
9 | raise ValueError
10 |
11 | return round((cl * percentage) / (100 * 1.5), 2)
12 |
13 | @staticmethod
14 | def unit_to_gram(units):
15 | return round(units * 12)
--------------------------------------------------------------------------------
/Unittest/6-how-to-catch-a-raise-error/code-start/library/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parisnakitakejser/video-tutorial-python-code/061e29830e406f6bd104f09595d7e4371683503a/Unittest/6-how-to-catch-a-raise-error/code-start/library/__init__.py
--------------------------------------------------------------------------------
/Unittest/6-how-to-catch-a-raise-error/code-start/library/alcohol.py:
--------------------------------------------------------------------------------
1 | class Alcohol:
2 | @staticmethod
3 | def calc_unit(cl, percentage):
4 | return round((cl * percentage) / (100 * 1.5), 2)
5 |
6 | @staticmethod
7 | def unit_to_gram(units):
8 | return round(units * 12)
--------------------------------------------------------------------------------
/aws/AWS-CDK/APIGateway/using-lambda-authorizers-on-routes/app.py:
--------------------------------------------------------------------------------
1 | from aws_cdk import App
2 | from awsStack.awsRootStack import awsRootStack
3 |
4 |
5 | app = App()
6 | awsRootStack(app, 'ApiGatewayWithAuthorizersStack')
7 | app.synth()
8 |
--------------------------------------------------------------------------------
/aws/AWS-CDK/APIGateway/using-lambda-authorizers-on-routes/awsStack/awsRootStack.py:
--------------------------------------------------------------------------------
1 | from aws_cdk import Stack
2 | from constructs import Construct
3 |
4 | from awsStack.apiGatewayStack import ApiGatewayStack
5 |
6 |
7 | class awsRootStack(Stack):
8 | def __init__(self, scope: Construct, id: str, **kwargs) -> None:
9 | super().__init__(scope, id, **kwargs)
10 |
11 | self.api_gateway = ApiGatewayStack(self, "ApiGatewayStack")
12 |
--------------------------------------------------------------------------------
/aws/AWS-CDK/APIGateway/using-lambda-authorizers-on-routes/cdk.json:
--------------------------------------------------------------------------------
1 | {
2 | "app": "python3 app.py"
3 | }
--------------------------------------------------------------------------------
/aws/AWS-CDK/APIGateway/using-lambda-authorizers-on-routes/lambdaAssets/apiGateway/getUser.py:
--------------------------------------------------------------------------------
1 | import json
2 |
3 |
4 | def lambda_handler(event, context):
5 | return {
6 | "statusCode": 200,
7 | "body": json.dumps("User Authorization"),
8 | }
9 |
--------------------------------------------------------------------------------
/aws/AWS-CDK/APIGateway/using-lambda-authorizers-on-routes/lambdaAssets/apiGateway/userAuthorizer.py:
--------------------------------------------------------------------------------
1 | def lambda_handler(event, context):
2 | return {
3 | "isAuthorized": True,
4 | "context": {
5 | "userId": "TestId",
6 | },
7 | }
8 |
--------------------------------------------------------------------------------
/aws/AWS-CDK/APIGateway/using-lambda-authorizers-on-routes/requirements.txt:
--------------------------------------------------------------------------------
1 | attrs==21.4.0
2 | aws-cdk-lib==2.23.0
3 | aws-cdk.aws-apigatewayv2-alpha==2.23.0a0
4 | aws-cdk.aws-apigatewayv2-authorizers-alpha==2.23.0a0
5 | aws-cdk.aws-apigatewayv2-integrations-alpha==2.23.0a0
6 | aws-cdk.aws-lambda-python-alpha==2.23.0a0
7 | black==22.3.0
8 | boto3==1.22.11
9 | botocore==1.25.11
10 | cattrs==22.1.0
11 | click==8.1.3
12 | constructs==10.1.3
13 | exceptiongroup==1.0.0rc5
14 | flake8==4.0.1
15 | jmespath==1.0.0
16 | jsii==1.58.0
17 | mccabe==0.6.1
18 | mypy-extensions==0.4.3
19 | pathspec==0.9.0
20 | platformdirs==2.5.2
21 | publication==0.0.3
22 | pycodestyle==2.8.0
23 | pyflakes==2.4.0
24 | python-dateutil==2.8.2
25 | s3transfer==0.5.2
26 | six==1.16.0
27 | tomli==2.0.1
28 | typing_extensions==4.2.0
29 | urllib3==1.26.9
30 |
--------------------------------------------------------------------------------
/aws/AWS-CDK/CloudWatch/cost-monitor-lambda-functions/app.py:
--------------------------------------------------------------------------------
1 | from aws_cdk import App
2 | from infrastructure.prototypeCostStack import PrototypeCostStack
3 |
4 |
5 | app = App()
6 |
7 | PrototypeCostStack(app, "PrototypeCostStack")
8 |
9 | app.synth()
10 |
--------------------------------------------------------------------------------
/aws/AWS-CDK/CloudWatch/cost-monitor-lambda-functions/cdk.json:
--------------------------------------------------------------------------------
1 | {
2 | "app": "python3 app.py"
3 | }
--------------------------------------------------------------------------------
/aws/AWS-CDK/CloudWatch/cost-monitor-lambda-functions/infrastructure/prototypeCostStack.py:
--------------------------------------------------------------------------------
1 | from aws_cdk import Stack
2 | from constructs import Construct
3 |
4 | from infrastructure.lambdaStack import LambdaStack
5 |
6 |
7 | class PrototypeCostStack(Stack):
8 | def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
9 | super().__init__(scope, construct_id, **kwargs)
10 |
11 | self.lambda_stack = LambdaStack(self, "LambdaStack")
12 |
--------------------------------------------------------------------------------
/aws/AWS-CDK/CloudWatch/cost-monitor-lambda-functions/lambda/testLambda/index.py:
--------------------------------------------------------------------------------
1 | from time import sleep
2 |
3 |
4 | def handler(event, context):
5 | print("Hello world! - Sleep in 5 sec")
6 | sleep(5)
7 | print("Wake up from sleep")
8 |
--------------------------------------------------------------------------------
/aws/AWS-CDK/CloudWatch/cost-monitor-lambda-functions/requirements.txt:
--------------------------------------------------------------------------------
1 | aws-cdk-lib==2.43.0
2 | flake8
3 | boto3
4 | black
--------------------------------------------------------------------------------
/aws/AWS-CDK/DynamoDB/create-a-dynamodb-and-grant-access-to-lambda-functions-and-attach-it-to-an-api-gateway/app.py:
--------------------------------------------------------------------------------
1 | from aws_cdk import App
2 | from awsStack.awsRootStack import awsRootStack
3 |
4 |
5 | app = App()
6 | awsRootStack(app, 'TestRootStack')
7 | app.synth()
8 |
--------------------------------------------------------------------------------
/aws/AWS-CDK/DynamoDB/create-a-dynamodb-and-grant-access-to-lambda-functions-and-attach-it-to-an-api-gateway/awsStack/databaseStack.py:
--------------------------------------------------------------------------------
1 | from constructs import Construct
2 | from aws_cdk import (
3 | NestedStack, aws_dynamodb as dynamodb
4 | )
5 |
6 |
7 | class DynamoDBStack(NestedStack):
8 | def __init__(self, scope: Construct, id: str, **kwargs) -> None:
9 | super().__init__(scope, id, **kwargs)
10 |
11 | self.test_table = dynamodb.Table(self, "TestTable", table_name="TestTable",
12 | partition_key=dynamodb.Attribute(name="id", type=dynamodb.AttributeType.STRING),
13 | )
14 |
--------------------------------------------------------------------------------
/aws/AWS-CDK/DynamoDB/create-a-dynamodb-and-grant-access-to-lambda-functions-and-attach-it-to-an-api-gateway/cdk.json:
--------------------------------------------------------------------------------
1 | {
2 | "app": "python3 app.py"
3 | }
--------------------------------------------------------------------------------
/aws/AWS-CDK/DynamoDB/create-a-dynamodb-and-grant-access-to-lambda-functions-and-attach-it-to-an-api-gateway/lambdaAssets/apiGateway/getTableItem.py:
--------------------------------------------------------------------------------
1 | import boto3
2 |
3 |
4 | def lambda_handler(event, context):
5 | dynamodb = boto3.resource("dynamodb")
6 | table = dynamodb.Table("TestTable")
7 | table_item = table.get_item(Key={"id": event.get('pathParameters').get('itemId')})
8 |
9 | return {"content": "Get Table Item", "item": table_item}
10 |
--------------------------------------------------------------------------------
/aws/AWS-CDK/DynamoDB/create-a-dynamodb-and-grant-access-to-lambda-functions-and-attach-it-to-an-api-gateway/lambdaAssets/apiGateway/insertTableItem.py:
--------------------------------------------------------------------------------
1 | import boto3
2 | import uuid
3 |
4 |
5 | def lambda_handler(event, context):
6 | dynamodb = boto3.resource("dynamodb")
7 | table = dynamodb.Table("TestTable")
8 | item_id = uuid.uuid4().hex
9 | table.put_item(Item={"id": item_id, "testCode": "Your test string here"})
10 |
11 | return {"content": "Item insert into DynamoDB", "id": item_id}
12 |
--------------------------------------------------------------------------------
/aws/AWS-CDK/DynamoDB/create-a-dynamodb-and-grant-access-to-lambda-functions-and-attach-it-to-an-api-gateway/requirements.txt:
--------------------------------------------------------------------------------
1 | attrs==21.4.0
2 | aws-cdk-lib==2.23.0
3 | aws-cdk.aws-apigatewayv2-alpha==2.23.0a0
4 | aws-cdk.aws-apigatewayv2-integrations-alpha==2.23.0a0
5 | aws-cdk.aws-batch-alpha==2.23.0a0
6 | aws-cdk.aws-lambda-python-alpha==2.23.0a0
7 | cattrs==22.1.0
8 | constructs==10.1.3
9 | exceptiongroup==1.0.0rc5
10 | flake8==4.0.1
11 | jsii==1.58.0
12 | mccabe==0.6.1
13 | publication==0.0.3
14 | pycodestyle==2.8.0
15 | pyflakes==2.4.0
16 | python-dateutil==2.8.2
17 | six==1.16.0
18 | typing_extensions==4.2.0
19 |
--------------------------------------------------------------------------------
/aws/AWS-CDK/ECS/ecr-auto-rollout-new-image/app.py:
--------------------------------------------------------------------------------
1 | import aws_cdk
2 |
3 | from infrastructure.ecsAutoDeployPrototypeStack import ECSAutoDeployPrototypeStack
4 |
5 | app = aws_cdk.App()
6 |
7 | datacue_stack = ECSAutoDeployPrototypeStack(
8 | app,
9 | "ECSAutoDeployPrototypeStack",
10 | )
11 |
12 | app.synth()
13 |
--------------------------------------------------------------------------------
/aws/AWS-CDK/ECS/ecr-auto-rollout-new-image/assets/container/flask-app/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM python:3.9-buster
2 |
3 | RUN mkdir /app
4 | WORKDIR /app
5 |
6 | RUN pip install Flask
7 |
8 | COPY . .
9 |
10 | CMD ["python", "app.py"]
--------------------------------------------------------------------------------
/aws/AWS-CDK/ECS/ecr-auto-rollout-new-image/assets/container/flask-app/app.py:
--------------------------------------------------------------------------------
1 | from flask import Flask
2 |
3 | app = Flask(__name__)
4 |
5 |
6 | @app.route("/")
7 | def hello():
8 | return "Hello, World!
"
9 |
10 |
11 | @app.route("/health")
12 | def health():
13 | return "OK"
14 |
15 |
16 | if __name__ == "__main__":
17 | app.run(host="0.0.0.0", debug=True)
18 |
--------------------------------------------------------------------------------
/aws/AWS-CDK/ECS/ecr-auto-rollout-new-image/assets/lambda/deployEvent/index.py:
--------------------------------------------------------------------------------
1 | import boto3
2 | import os
3 |
4 | client = boto3.client("ecs")
5 |
6 | CLUSTER_NAME = os.environ.get("CLUSTER_NAME")
7 | SERVICE_NAME = os.environ.get("SERVICE_NAME")
8 |
9 |
10 | def handler(event, _):
11 | print(event)
12 |
13 | response = client.update_service(
14 | cluster=CLUSTER_NAME, service=SERVICE_NAME, forceNewDeployment=True
15 | )
16 |
17 | print(response)
18 |
--------------------------------------------------------------------------------
/aws/AWS-CDK/ECS/ecr-auto-rollout-new-image/cdk.json:
--------------------------------------------------------------------------------
1 | {
2 | "app": "python3 app.py"
3 | }
--------------------------------------------------------------------------------
/aws/AWS-CDK/ECS/ecr-auto-rollout-new-image/requirements.txt:
--------------------------------------------------------------------------------
1 | aws-cdk-lib==2.42.1
2 | boto3==1.24.20
3 |
4 | # Local development tools
5 | flake8
6 | python-dotenv==0.20.0
7 | black
--------------------------------------------------------------------------------
/aws/AWS-CDK/ECS/ecr-auto-rollout-new-image/setup.cfg:
--------------------------------------------------------------------------------
1 | [flake8]
2 | ignore = E501,F401,W503,F841,W293,E902,E203
3 | count = True
4 | exclude =
5 | **/ebawsconnect**,
6 | **/node_modules**,
7 | **/lib/**,
8 | **/site-packages/**,
9 | **/bin/**,
10 | **/versions/**
--------------------------------------------------------------------------------
/aws/AWS-CDK/ECS/share-efs-mount-with-multi-containers-in-a-services/app.py:
--------------------------------------------------------------------------------
1 | import aws_cdk
2 |
3 | from infrastructure.sharedEFSMountInECSClusterPrototypeStack import (
4 | SharedEFSMountInECSClusterPrototypeStack,
5 | )
6 |
7 | app = aws_cdk.App()
8 |
9 | SharedEFSMountInECSClusterPrototypeStack(
10 | app,
11 | "SharedEFSMountInECSClusterPrototypeStack",
12 | )
13 |
14 | app.synth()
15 |
--------------------------------------------------------------------------------
/aws/AWS-CDK/ECS/share-efs-mount-with-multi-containers-in-a-services/cdk.json:
--------------------------------------------------------------------------------
1 | {
2 | "app": "python3 app.py"
3 | }
--------------------------------------------------------------------------------
/aws/AWS-CDK/ECS/share-efs-mount-with-multi-containers-in-a-services/docker/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM python:3.9-buster
2 |
3 | RUN apt-get update && \
4 | apt-get dist-upgrade -y
5 |
6 | COPY requirements.txt .
7 |
8 | RUN pip install -r requirements.txt
9 |
10 | COPY . .
11 |
12 | CMD [ "python", "app.py" ]
--------------------------------------------------------------------------------
/aws/AWS-CDK/ECS/share-efs-mount-with-multi-containers-in-a-services/docker/app.py:
--------------------------------------------------------------------------------
1 | from flask import Flask
2 |
3 | app = Flask(__name__)
4 |
5 |
6 | @app.route("/")
7 | def index():
8 | return "Web App with Python Flask!"
9 |
10 |
11 | @app.route("/health")
12 | def health():
13 | return "OK"
14 |
15 |
16 | app.run(host="0.0.0.0", port=5000)
17 |
--------------------------------------------------------------------------------
/aws/AWS-CDK/ECS/share-efs-mount-with-multi-containers-in-a-services/docker/requirements.txt:
--------------------------------------------------------------------------------
1 | flask
--------------------------------------------------------------------------------
/aws/AWS-CDK/ECS/share-efs-mount-with-multi-containers-in-a-services/infrastructure/sharedEFSMountInECSClusterPrototypeStack.py:
--------------------------------------------------------------------------------
1 | from aws_cdk import Stack, aws_ecr as ecr
2 | from constructs import Construct
3 |
4 | from infrastructure.ecsStack import ECSStack
5 | from infrastructure.networkStack import NetworkStack
6 |
7 |
8 | class SharedEFSMountInECSClusterPrototypeStack(Stack):
9 | def __init__(
10 | self,
11 | scope: Construct,
12 | id: str,
13 | **kwargs,
14 | ) -> None:
15 | super().__init__(scope, id, **kwargs)
16 |
17 | self.network = NetworkStack(self, "NetworkStack")
18 |
19 | self.ecs = ECSStack(self, "ECSStack", vpc=self.network.vpc)
20 |
--------------------------------------------------------------------------------
/aws/AWS-CDK/ECS/share-efs-mount-with-multi-containers-in-a-services/requirements.txt:
--------------------------------------------------------------------------------
1 | aws-cdk-lib==2.55.0
2 | boto3
3 |
4 | # Local development tools
5 | flake8
6 | python-dotenv==0.20.0
7 | black
--------------------------------------------------------------------------------
/aws/AWS-CDK/ECS/share-efs-mount-with-multi-containers-in-a-services/setup.cfg:
--------------------------------------------------------------------------------
1 | [flake8]
2 | ignore = E501,F401,W503,F841,W293,E902,E203
3 | count = True
4 | exclude =
5 | **/ebawsconnect**,
6 | **/node_modules**,
7 | **/lib/**,
8 | **/site-packages/**,
9 | **/bin/**,
10 | **/versions/**
--------------------------------------------------------------------------------
/aws/AWS-CDK/EKS/setup-readonly-user-role-in-aws-eks/.gitignore:
--------------------------------------------------------------------------------
1 | cdk.out
2 | *.pyc
--------------------------------------------------------------------------------
/aws/AWS-CDK/EKS/setup-readonly-user-role-in-aws-eks/README.md:
--------------------------------------------------------------------------------
1 | # Cluster connection
2 | Kubernetes cluster init by AWS CDK
3 |
4 | Connection to Kubernetes cluster using AWS CLI as administrator
5 |
6 | ```
7 | aws eks update-kubeconfig --name {cluster-name} --region {region} --role-arn arn:aws:iam::{account-id}:role/aws-eks-admin
8 | ```
9 |
10 | Connection to Kubernetes cluster using AWS CLI as readonly member
11 |
12 | ```
13 | aws eks update-kubeconfig --name {cluster-name} --region {region} --role-arn arn:aws:iam::{account-id}:role/aws-eks-readonly
14 | ```
--------------------------------------------------------------------------------
/aws/AWS-CDK/EKS/setup-readonly-user-role-in-aws-eks/app.py:
--------------------------------------------------------------------------------
1 | from aws_cdk import App, Environment
2 | from infrastructure.kubernetesStack import KubernetesStack
3 |
4 | app = App()
5 |
6 | env = Environment()
7 |
8 | rds_stack = KubernetesStack(app, "KubernetesStack", env=env)
9 |
10 | app.synth()
11 |
--------------------------------------------------------------------------------
/aws/AWS-CDK/EKS/setup-readonly-user-role-in-aws-eks/cdk.json:
--------------------------------------------------------------------------------
1 | {
2 | "app": "python3 app.py"
3 | }
--------------------------------------------------------------------------------
/aws/AWS-CDK/EKS/setup-readonly-user-role-in-aws-eks/requirements.txt:
--------------------------------------------------------------------------------
1 | aws-cdk-lib==2.75.0
2 | flake8
3 | boto3
4 | black
5 | pyyaml
--------------------------------------------------------------------------------
/aws/AWS-CDK/EKS/setup-readonly-user-role-in-aws-eks/setup.cfg:
--------------------------------------------------------------------------------
1 | [flake8]
2 | ignore = E501,F401,W503,F841,W293,E902,E203
3 | count = True
4 | exclude =
5 | **/ebawsconnect**,
6 | **/node_modules**,
7 | **/lib/**,
8 | **/site-packages/**,
9 | **/bin/**,
10 | **/versions/**
--------------------------------------------------------------------------------
/aws/AWS-CDK/ELB/el-with-mutli-domain-support/app.py:
--------------------------------------------------------------------------------
1 | import aws_cdk
2 | from infrastructure.lbStack import LBStack
3 |
4 | app = aws_cdk.App()
5 |
6 | lb_stack = LBStack(
7 | app,
8 | "LBStack",
9 | )
10 |
11 | app.synth()
12 |
--------------------------------------------------------------------------------
/aws/AWS-CDK/ELB/el-with-mutli-domain-support/assets/container/flask-app/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM python:3.9-buster
2 |
3 | RUN mkdir /app
4 | WORKDIR /app
5 |
6 | RUN pip install Flask
7 |
8 | COPY . .
9 |
10 | CMD ["python", "app.py"]
--------------------------------------------------------------------------------
/aws/AWS-CDK/ELB/el-with-mutli-domain-support/assets/container/flask-app/app.py:
--------------------------------------------------------------------------------
1 | from flask import Flask
2 | import os
3 |
4 | app = Flask(__name__)
5 |
6 |
7 | @app.route("/")
8 | def hello():
9 | return f"ECS STACK: {os.getenv('STACK_NAME')}
"
10 |
11 |
12 | @app.route("/health")
13 | def health():
14 | return "OK"
15 |
16 |
17 | if __name__ == "__main__":
18 | app.run(host="0.0.0.0", debug=True)
19 |
--------------------------------------------------------------------------------
/aws/AWS-CDK/ELB/el-with-mutli-domain-support/cdk.json:
--------------------------------------------------------------------------------
1 | {
2 | "app": "python3 app.py"
3 | }
--------------------------------------------------------------------------------
/aws/AWS-CDK/ELB/el-with-mutli-domain-support/requirements.txt:
--------------------------------------------------------------------------------
1 | aws-cdk-lib==2.43.1
2 | boto3==1.24.78
3 |
4 | # Local development tools
5 | flake8
6 | python-dotenv==0.20.0
7 | black
--------------------------------------------------------------------------------
/aws/AWS-CDK/ELB/el-with-mutli-domain-support/setup.cfg:
--------------------------------------------------------------------------------
1 | [flake8]
2 | ignore = E501,F401,W503,F841,W293,E902,E203
3 | count = True
4 | exclude =
5 | **/ebawsconnect**,
6 | **/node_modules**,
7 | **/lib/**,
8 | **/site-packages/**,
9 | **/bin/**,
10 | **/versions/**
--------------------------------------------------------------------------------
/aws/AWS-CDK/ELB/elb-with-ssl-support/app.py:
--------------------------------------------------------------------------------
1 | import aws_cdk
2 | from infrastructure.lbStack import LBStack
3 |
4 | app = aws_cdk.App()
5 |
6 | lb_stack = LBStack(
7 | app,
8 | "LBStack",
9 | )
10 |
11 | app.synth()
12 |
--------------------------------------------------------------------------------
/aws/AWS-CDK/ELB/elb-with-ssl-support/cdk.json:
--------------------------------------------------------------------------------
1 | {
2 | "app": "python3 app.py"
3 | }
--------------------------------------------------------------------------------
/aws/AWS-CDK/ELB/elb-with-ssl-support/requirements.txt:
--------------------------------------------------------------------------------
1 | aws-cdk-lib==2.43.1
2 | boto3==1.24.78
3 |
4 | # Local development tools
5 | flake8
6 | python-dotenv==0.20.0
7 | black
--------------------------------------------------------------------------------
/aws/AWS-CDK/ELB/elb-with-ssl-support/setup.cfg:
--------------------------------------------------------------------------------
1 | [flake8]
2 | ignore = E501,F401,W503,F841,W293,E902,E203
3 | count = True
4 | exclude =
5 | **/ebawsconnect**,
6 | **/node_modules**,
7 | **/lib/**,
8 | **/site-packages/**,
9 | **/bin/**,
10 | **/versions/**
--------------------------------------------------------------------------------
/aws/AWS-CDK/IAM/github-action-use-oidc-provider/app.py:
--------------------------------------------------------------------------------
1 | from aws_cdk import App
2 | from infrastructure.prototypeOIDCProvider import PrototypeOIDCProvider
3 |
4 |
5 | app = App()
6 |
7 | PrototypeOIDCProvider(app, "PrototypeOIDCProvider")
8 |
9 | app.synth()
10 |
--------------------------------------------------------------------------------
/aws/AWS-CDK/IAM/github-action-use-oidc-provider/cdk.json:
--------------------------------------------------------------------------------
1 | {
2 | "app": "python3 app.py"
3 | }
--------------------------------------------------------------------------------
/aws/AWS-CDK/IAM/github-action-use-oidc-provider/requirements.txt:
--------------------------------------------------------------------------------
1 | aws-cdk-lib==2.45.0
2 | flake8
3 | boto3
4 | black
--------------------------------------------------------------------------------
/aws/AWS-CDK/Lambda/disable-lambda-on-to-many-ivocations/app.py:
--------------------------------------------------------------------------------
1 | from aws_cdk import App
2 | from infrastructure.prototypeDisableLambdaStack import PrototypeDisableLambdaStack
3 |
4 |
5 | app = App()
6 |
7 | PrototypeDisableLambdaStack(app, "PrototypeDisableLambdaStack")
8 |
9 | app.synth()
10 |
--------------------------------------------------------------------------------
/aws/AWS-CDK/Lambda/disable-lambda-on-to-many-ivocations/assets/lambda/testLambda/index.py:
--------------------------------------------------------------------------------
1 | from time import sleep
2 |
3 |
4 | def handler(event, context):
5 | print("Hello world! - Lambda testing")
6 |
--------------------------------------------------------------------------------
/aws/AWS-CDK/Lambda/disable-lambda-on-to-many-ivocations/cdk.json:
--------------------------------------------------------------------------------
1 | {
2 | "app": "python3 app.py"
3 | }
--------------------------------------------------------------------------------
/aws/AWS-CDK/Lambda/disable-lambda-on-to-many-ivocations/infrastructure/prototypeDisableLambdaStack.py:
--------------------------------------------------------------------------------
1 | from aws_cdk import Stack
2 | from constructs import Construct
3 |
4 | from infrastructure.lambdaStack import LambdaStack
5 |
6 |
7 | class PrototypeDisableLambdaStack(Stack):
8 | def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
9 | super().__init__(scope, construct_id, **kwargs)
10 |
11 | self.lambda_stack = LambdaStack(self, "LambdaStack")
12 |
--------------------------------------------------------------------------------
/aws/AWS-CDK/Lambda/disable-lambda-on-to-many-ivocations/requirements.txt:
--------------------------------------------------------------------------------
1 | aws-cdk-lib==2.45.0
2 | flake8
3 | boto3
4 | black
--------------------------------------------------------------------------------
/aws/AWS-CDK/Lambda/mount-efs-access-point-for-lambda/app.py:
--------------------------------------------------------------------------------
1 | from aws_cdk import App
2 | from infrastructure.prototypeStack import PrototypeStack
3 |
4 |
5 | app = App()
6 |
7 | PrototypeStack(app, "PrototypeLambdaWithEFSAccessPoint")
8 |
9 | app.synth()
10 |
--------------------------------------------------------------------------------
/aws/AWS-CDK/Lambda/mount-efs-access-point-for-lambda/cdk.json:
--------------------------------------------------------------------------------
1 | {
2 | "app": "python3 app.py"
3 | }
--------------------------------------------------------------------------------
/aws/AWS-CDK/Lambda/mount-efs-access-point-for-lambda/infrastructure/s3Stack.py:
--------------------------------------------------------------------------------
1 | from aws_cdk import (
2 | NestedStack,
3 | RemovalPolicy,
4 | aws_s3 as s3,
5 | )
6 | from constructs import Construct
7 |
8 |
9 | class S3Stack(NestedStack):
10 | def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
11 | super().__init__(scope, construct_id, **kwargs)
12 |
13 | self.bucket = s3.Bucket(
14 | self, "PrototypeBucket", removal_policy=RemovalPolicy.DESTROY
15 | )
16 |
--------------------------------------------------------------------------------
/aws/AWS-CDK/Lambda/mount-efs-access-point-for-lambda/requirements.txt:
--------------------------------------------------------------------------------
1 | aws-cdk-lib==2.55.0
2 | flake8
3 | boto3
4 | black
--------------------------------------------------------------------------------
/aws/AWS-CDK/VPC/create-vpc-endpoint-interface-aws-privatelink/app.py:
--------------------------------------------------------------------------------
1 | from aws_cdk import App
2 | from awsStack.awsRootStack import awsRootStack
3 |
4 |
5 | app = App()
6 | awsRootStack(app, "InterfaceVpcEndpointStack")
7 | app.synth()
8 |
--------------------------------------------------------------------------------
/aws/AWS-CDK/VPC/create-vpc-endpoint-interface-aws-privatelink/awsStack/awsRootStack.py:
--------------------------------------------------------------------------------
1 | from aws_cdk import Stack
2 | from constructs import Construct
3 |
4 | from awsStack.lambdaStack import LambdaStack
5 | from awsStack.networkStack import NetworkStack
6 |
7 |
8 | class awsRootStack(Stack):
9 | def __init__(self, scope: Construct, id: str, **kwargs) -> None:
10 | super().__init__(scope, id, **kwargs)
11 |
12 | self.network_stack = NetworkStack(
13 | self,
14 | "NetworkStack",
15 | )
16 |
17 | self.lambda_stack = LambdaStack(
18 | self, "LambdaStack", network_stack=self.network_stack
19 | )
20 |
--------------------------------------------------------------------------------
/aws/AWS-CDK/VPC/create-vpc-endpoint-interface-aws-privatelink/awsStack/lambdaStack.py:
--------------------------------------------------------------------------------
1 | from constructs import Construct
2 | from aws_cdk import NestedStack, aws_lambda as lambda_
3 |
4 | from awsStack.networkStack import NetworkStack
5 |
6 |
7 | class LambdaStack(NestedStack):
8 | def __init__(
9 | self, scope: Construct, id: str, network_stack: NetworkStack, **kwargs
10 | ) -> None:
11 | super().__init__(scope, id, **kwargs)
12 |
13 | self.lambda_get_item = lambda_.Function(
14 | self,
15 | "HelloWorld",
16 | runtime=lambda_.Runtime.PYTHON_3_9,
17 | code=lambda_.Code.from_asset("lambdaAssets/"),
18 | handler="helloWorld.lambda_handler",
19 | vpc=network_stack.vpc_network,
20 | )
21 |
--------------------------------------------------------------------------------
/aws/AWS-CDK/VPC/create-vpc-endpoint-interface-aws-privatelink/cdk.json:
--------------------------------------------------------------------------------
1 | {
2 | "app": "python3 app.py"
3 | }
--------------------------------------------------------------------------------
/aws/AWS-CDK/VPC/create-vpc-endpoint-interface-aws-privatelink/lambdaAssets/helloWorld.py:
--------------------------------------------------------------------------------
1 | import json
2 |
3 |
4 | def lambda_handler(event, context):
5 | return {"statusCode": 200, "body": json.dumps({"content": "demo"})}
6 |
--------------------------------------------------------------------------------
/aws/AWS-CDK/VPC/create-vpc-endpoint-interface-aws-privatelink/requirements.txt:
--------------------------------------------------------------------------------
1 | attrs==21.4.0
2 | aws-cdk-lib==2.23.0
3 | aws-cdk.aws-apigatewayv2-alpha==2.23.0a0
4 | aws-cdk.aws-apigatewayv2-authorizers-alpha==2.23.0a0
5 | aws-cdk.aws-apigatewayv2-integrations-alpha==2.23.0a0
6 | aws-cdk.aws-lambda-python-alpha==2.23.0a0
7 | black==22.3.0
8 | boto3==1.22.11
9 | botocore==1.25.11
10 | cattrs==22.1.0
11 | click==8.1.3
12 | constructs==10.1.3
13 | exceptiongroup==1.0.0rc5
14 | flake8==4.0.1
15 | jmespath==1.0.0
16 | jsii==1.58.0
17 | mccabe==0.6.1
18 | mypy-extensions==0.4.3
19 | pathspec==0.9.0
20 | platformdirs==2.5.2
21 | publication==0.0.3
22 | pycodestyle==2.8.0
23 | pyflakes==2.4.0
24 | python-dateutil==2.8.2
25 | s3transfer==0.5.2
26 | six==1.16.0
27 | tomli==2.0.1
28 | typing_extensions==4.2.0
29 | urllib3==1.26.9
30 |
--------------------------------------------------------------------------------
/aws/AWS-CDK/VPC/vpc-cross-account-peering/app.py:
--------------------------------------------------------------------------------
1 | from infrastructure.prototypeVPCPeeringAccountOneStack import PrototypeVPCPeeringAccountOneStack
2 | from infrastructure.prototypeVPCPeeringAccountTwoStack import PrototypeVPCPeeringAccountTwoStack
3 | from infrastructure.prototypeVPCPeerOneWithTwo import PrototypeVPCPeerOneWithTwo
4 | from aws_cdk import App
5 |
6 | app = App()
7 |
8 | network_one = PrototypeVPCPeeringAccountOneStack(app, "PrototypeVPCPeeringAccountOneStack")
9 | network_two = PrototypeVPCPeeringAccountTwoStack(app, "PrototypeVPCPeeringAccountTwoStack")
10 | network_connection = PrototypeVPCPeerOneWithTwo(app, "PrototypeVPCPeerOneWithTwo", network_one=network_one)
11 |
12 | app.synth()
13 |
--------------------------------------------------------------------------------
/aws/AWS-CDK/VPC/vpc-cross-account-peering/cdk.json:
--------------------------------------------------------------------------------
1 | {
2 | "app": "python3 app.py"
3 | }
--------------------------------------------------------------------------------
/aws/AWS-CDK/VPC/vpc-cross-account-peering/requirements.txt:
--------------------------------------------------------------------------------
1 | aws-cdk-lib==2.54.0
2 | flake8
3 | boto3
4 | black
--------------------------------------------------------------------------------
/aws/AWS-CDK/VPC/vpc-cross-account-peering/settings.py:
--------------------------------------------------------------------------------
1 | AWS_ACCOUNT_ONE_ID = '{aws-id}'
2 | AWS_ACCOUNT_ONE_REGION = 'eu-west-1'
3 | AWS_ACCOUNT_ONE_VPC_CIDR = '10.21.0.0/16'
4 | AWS_ACCOUNT_ONE_VPC_ID = 'vpc-{id}' # Replace after first Network one is deployed
5 |
6 | AWS_ACCOUNT_TWO_ID = '{aws-id}'
7 | AWS_ACCOUNT_TWO_VPC_CIDR = '10.22.0.0/16'
8 | AWS_ACCOUNT_TWO_PEERING_ID = 'pcx-{id}' # Replace after first Network Two is deployed
9 |
--------------------------------------------------------------------------------
/aws/AWS-CDK/VPC/vpc-peering/app.py:
--------------------------------------------------------------------------------
1 | from aws_cdk import App
2 | from infrastructure.prototypeAlbStack import PrototypeALBStack
3 |
4 |
5 | app = App()
6 |
7 | PrototypeALBStack(app, "PrototypeALBStack")
8 |
9 | app.synth()
10 |
--------------------------------------------------------------------------------
/aws/AWS-CDK/VPC/vpc-peering/cdk.json:
--------------------------------------------------------------------------------
1 | {
2 | "app": "python3 app.py"
3 | }
--------------------------------------------------------------------------------
/aws/AWS-CDK/VPC/vpc-peering/public_image/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM python:3.9-buster
2 |
3 | RUN mkdir /app
4 | WORKDIR /app
5 | COPY . .
6 |
7 | RUN pip install -U Flask
8 | RUN pip install requests
9 |
10 | CMD ["python", "app.py"]
--------------------------------------------------------------------------------
/aws/AWS-CDK/VPC/vpc-peering/requirements.txt:
--------------------------------------------------------------------------------
1 | aws-cdk-lib==2.43.0
2 | flake8
3 | boto3
4 | black
--------------------------------------------------------------------------------
/aws/Cognito/2-create user account and verification with confirmation-code/.env-sample:
--------------------------------------------------------------------------------
1 | COGNITO_USER_CLIENT_ID=
2 | COGNITO_REGION_NAME=
--------------------------------------------------------------------------------
/aws/Cognito/2-create user account and verification with confirmation-code/confirm_sign_up.py:
--------------------------------------------------------------------------------
1 | import os
2 | import boto3
3 | from dotenv import load_dotenv
4 | load_dotenv()
5 |
6 | username = 'hi@pnk.sh'
7 | confirm_code = '248659'
8 |
9 | client = boto3.client('cognito-idp', region_name=os.getenv('COGNITO_REGION_NAME'))
10 | response = client.confirm_sign_up(
11 | ClientId=os.getenv('COGNITO_USER_CLIENT_ID'),
12 | Username=username,
13 | ConfirmationCode=confirm_code
14 | )
15 |
16 | print(response)
--------------------------------------------------------------------------------
/aws/Cognito/2-create user account and verification with confirmation-code/requirements.txt:
--------------------------------------------------------------------------------
1 | boto3==1.16.63
2 | botocore==1.19.63
3 | jmespath==0.10.0
4 | python-dateutil==2.8.1
5 | python-dotenv==0.15.0
6 | s3transfer==0.3.4
7 | six==1.15.0
8 | urllib3==1.26.3
9 |
--------------------------------------------------------------------------------
/aws/Cognito/2-create user account and verification with confirmation-code/resend_confirmation_code.py:
--------------------------------------------------------------------------------
1 | import os
2 | import boto3
3 | from dotenv import load_dotenv
4 | load_dotenv()
5 |
6 | username = 'hi@pnk.sh'
7 |
8 | client = boto3.client('cognito-idp', region_name=os.getenv('COGNITO_REGION_NAME'))
9 | response = client.resend_confirmation_code(
10 | ClientId=os.getenv('COGNITO_USER_CLIENT_ID'),
11 | Username=username,
12 | )
13 |
14 | print(response)
--------------------------------------------------------------------------------
/aws/Cognito/2-create user account and verification with confirmation-code/sign_up.py:
--------------------------------------------------------------------------------
1 | import os
2 | import boto3
3 | from dotenv import load_dotenv
4 | load_dotenv()
5 |
6 | username = 'hi@pnk.sh'
7 | password = '#Abc1234'
8 |
9 | client = boto3.client('cognito-idp', region_name=os.getenv('COGNITO_REGION_NAME'))
10 | response = client.sign_up(
11 | ClientId=os.getenv('COGNITO_USER_CLIENT_ID'),
12 | Username=username,
13 | Password=password
14 | )
15 |
16 | print(response)
--------------------------------------------------------------------------------
/aws/Cognito/3-login-with-user-and-get-user-data-response-from-access-token/.env-sample:
--------------------------------------------------------------------------------
1 | COGNITO_USER_CLIENT_ID=
2 | COGNITO_REGION_NAME=
--------------------------------------------------------------------------------
/aws/Cognito/3-login-with-user-and-get-user-data-response-from-access-token/initiate_auth.py:
--------------------------------------------------------------------------------
1 | import os
2 | import boto3
3 | from dotenv import load_dotenv
4 | load_dotenv()
5 |
6 | username = 'hi@pnk.sh'
7 | password = '#Abc1234'
8 |
9 | client = boto3.client('cognito-idp', region_name=os.getenv('COGNITO_REGION_NAME'))
10 | response = client.initiate_auth(
11 | ClientId=os.getenv('COGNITO_USER_CLIENT_ID'),
12 | AuthFlow='USER_PASSWORD_AUTH',
13 | AuthParameters={
14 | 'USERNAME': username,
15 | 'PASSWORD': password
16 | }
17 | )
18 |
19 | # print(response)
20 |
21 | print('AccessToken', response['AuthenticationResult']['AccessToken'])
22 | print('RefreshToken', response['AuthenticationResult']['RefreshToken'])
--------------------------------------------------------------------------------
/aws/Cognito/3-login-with-user-and-get-user-data-response-from-access-token/requirements.txt:
--------------------------------------------------------------------------------
1 | boto3==1.16.63
2 | botocore==1.19.63
3 | jmespath==0.10.0
4 | python-dateutil==2.8.1
5 | python-dotenv==0.15.0
6 | s3transfer==0.3.4
7 | six==1.15.0
8 | urllib3==1.26.3
9 |
--------------------------------------------------------------------------------
/aws/Cognito/4-reset-user-password-and-change-the-password/.env-sample:
--------------------------------------------------------------------------------
1 | COGNITO_USER_CLIENT_ID=
2 | COGNITO_REGION_NAME=
--------------------------------------------------------------------------------
/aws/Cognito/4-reset-user-password-and-change-the-password/confirm_forgot_password.py:
--------------------------------------------------------------------------------
1 | import os
2 | import boto3
3 | from dotenv import load_dotenv
4 | load_dotenv()
5 |
6 | username = 'hi@pnk.sh'
7 | confirm_code = '580757'
8 | password = '#Qwe1234'
9 |
10 | client = boto3.client('cognito-idp', region_name=os.getenv('COGNITO_REGION_NAME'))
11 | response = client.confirm_forgot_password(
12 | ClientId=os.getenv('COGNITO_USER_CLIENT_ID'),
13 | Username=username,
14 | ConfirmationCode=confirm_code,
15 | Password=password
16 | )
17 |
18 | print(response)
--------------------------------------------------------------------------------
/aws/Cognito/4-reset-user-password-and-change-the-password/forgot_password.py:
--------------------------------------------------------------------------------
1 | import os
2 | import boto3
3 | from dotenv import load_dotenv
4 | load_dotenv()
5 |
6 | username = 'hi@pnk.sh'
7 |
8 | client = boto3.client('cognito-idp', region_name=os.getenv('COGNITO_REGION_NAME'))
9 | response = client.forgot_password(
10 | ClientId=os.getenv('COGNITO_USER_CLIENT_ID'),
11 | Username=username
12 | )
13 |
14 | print(response)
--------------------------------------------------------------------------------
/aws/Cognito/4-reset-user-password-and-change-the-password/requirements.txt:
--------------------------------------------------------------------------------
1 | boto3==1.16.63
2 | botocore==1.19.63
3 | jmespath==0.10.0
4 | python-dateutil==2.8.1
5 | python-dotenv==0.15.0
6 | s3transfer==0.3.4
7 | six==1.15.0
8 | urllib3==1.26.3
9 |
--------------------------------------------------------------------------------
/aws/DynamoDB/working-with-dynamodb-stream-with-lambda/lambda_assets/dynamoDBStream/lambda_handler.py:
--------------------------------------------------------------------------------
1 | def handler(event, context):
2 | print('Incoming event: ', event)
3 |
4 | for record in event['Records']:
5 | print(record)
6 |
7 | return {}
--------------------------------------------------------------------------------
/aws/DynamoDB/working-with-dynamodb-stream-with-lambda/policy.json:
--------------------------------------------------------------------------------
1 | {
2 | "Version": "2012-10-17",
3 | "Statement": [
4 | {
5 | "Effect": "Allow",
6 | "Action": [
7 | "lambda:*",
8 | "dynamodb:DescribeStream",
9 | "dynamodb:GetRecords",
10 | "dynamodb:GetShardIterator",
11 | "dynamodb:ListStreams",
12 | "sqs:SendMessage"
13 | ],
14 | "Resource": "*"
15 | }
16 | ]
17 | }
--------------------------------------------------------------------------------
/aws/DynamoDB/working-with-dynamodb-stream-with-lambda/role.json:
--------------------------------------------------------------------------------
1 | {
2 | "Version": "2012-10-17",
3 | "Statement": {
4 | "Effect": "Allow",
5 | "Principal": {
6 | "Service": "lambda.amazonaws.com"
7 | },
8 | "Action": "sts:AssumeRole"
9 | }
10 | }
--------------------------------------------------------------------------------
/aws/Lambda/how-to-work-with-lambda-layers/pymongo/requirements.txt:
--------------------------------------------------------------------------------
1 | pymongo==4.1.1
2 | dnspython==2.2.1
--------------------------------------------------------------------------------
/mongoengine/1-how-to-connect-to-mongo-database/alias-connect.py:
--------------------------------------------------------------------------------
1 | from mongoengine import connect
2 |
3 | connect(
4 | db='project1',
5 | host='127.0.0.1',
6 | port=27017,
7 | username='mongoadmin',
8 | password='secret',
9 | authentication_source='admin',
10 | alias='project1'
11 | )
12 |
13 | connect(
14 | db='project2',
15 | host='127.0.0.1',
16 | port=27017,
17 | username='mongoadmin',
18 | password='secret',
19 | authentication_source='admin',
20 | alias='project2'
21 | )
22 |
23 |
--------------------------------------------------------------------------------
/mongoengine/1-how-to-connect-to-mongo-database/auth-connect.py:
--------------------------------------------------------------------------------
1 | from mongoengine import connect
2 |
3 | connect(
4 | db='project1',
5 | host='127.0.0.1',
6 | port=27017,
7 | username='mongoadmin',
8 | password='secret',
9 | authentication_source='admin'
10 | )
--------------------------------------------------------------------------------
/mongoengine/1-how-to-connect-to-mongo-database/disconnect.py:
--------------------------------------------------------------------------------
1 | from mongoengine import connect, disconnect
2 |
3 | connect(
4 | db='project1',
5 | host='127.0.0.1',
6 | port=27017,
7 | username='mongoadmin',
8 | password='secret',
9 | authentication_source='admin',
10 | alias='project1'
11 | )
12 |
13 | disconnect(alias='project1')
--------------------------------------------------------------------------------
/mongoengine/1-how-to-connect-to-mongo-database/requirements.txt:
--------------------------------------------------------------------------------
1 | mongoengine==0.19.1
2 | pymongo==3.10.1
3 | six==1.14.0
4 |
--------------------------------------------------------------------------------
/mongoengine/1-how-to-connect-to-mongo-database/simple-connect.py:
--------------------------------------------------------------------------------
1 | from mongoengine import connect
2 |
3 | # Simple connect just connect as defualt to own mongo host on local machine
4 | connect(db='project1')
5 |
6 | # Simple connect point to host and port whitout eny login auth.
7 | connect(db='project1', host='127.0.0.1', port=27017)
--------------------------------------------------------------------------------
/mongoengine/1-how-to-connect-to-mongo-database/uri-connect.py:
--------------------------------------------------------------------------------
1 | from mongoengine import connect
2 |
3 | connect(db='test', host='mongodb://mongoadmin:secret@localhost/project1')
--------------------------------------------------------------------------------
/mongoengine/2-insert-new-document-to-mongo/app.py:
--------------------------------------------------------------------------------
1 | from mongoengine import connect
2 | from mongoengine.errors import NotUniqueError
3 | from orm.user import User
4 |
5 | connect(
6 | db='project1',
7 | host='localhost',
8 | port=27017,
9 | username='mongoadmin',
10 | password='secret',
11 | authentication_source='admin'
12 | )
13 |
14 | try:
15 | user = User(email='test@email.com')
16 | user.first_name = 'Paris'
17 | user.last_name = 'Nakita Kejser'
18 | user.save()
19 | except NotUniqueError as e:
20 | print('E-mail allready found')
--------------------------------------------------------------------------------
/mongoengine/2-insert-new-document-to-mongo/orm/user.py:
--------------------------------------------------------------------------------
1 | from mongoengine import Document, StringField, EmailField
2 |
3 |
4 | class User(Document):
5 | email = EmailField(required=True, unique=True)
6 | first_name = StringField(max_length=50)
7 | last_name = StringField(max_length=50)
--------------------------------------------------------------------------------
/mongoengine/2-insert-new-document-to-mongo/requirements.txt:
--------------------------------------------------------------------------------
1 | mongoengine==0.19.1
2 | pymongo==3.10.1
3 | six==1.14.0
4 |
--------------------------------------------------------------------------------
/mongoengine/3-update-document-to-mongo/app.py:
--------------------------------------------------------------------------------
1 | from mongoengine import connect
2 | from orm.user import User
3 |
4 | connect(
5 | db='project1',
6 | host='localhost',
7 | port=27017,
8 | username='mongoadmin',
9 | password='secret',
10 | authentication_source='admin'
11 | )
12 |
13 | # Static params field updater
14 | user = User.objects(email='test@email.com')
15 | user.update(first_name='New Paris', last_name='Nakita Kejser')
16 |
17 | # Dynamic params field updater
18 | user2 = User.objects(email='test2@email.com')
19 | fields = {
20 | 'first_name': 'Secound Test',
21 | 'last_name': 'Frist Last Name'
22 | }
23 | user2.update(**fields)
24 |
25 |
--------------------------------------------------------------------------------
/mongoengine/3-update-document-to-mongo/orm/user.py:
--------------------------------------------------------------------------------
1 | from mongoengine import Document, StringField, EmailField
2 |
3 |
4 | class User(Document):
5 | email = EmailField(required=True, unique=True)
6 | first_name = StringField(max_length=50)
7 | last_name = StringField(max_length=50)
--------------------------------------------------------------------------------
/mongoengine/3-update-document-to-mongo/requirements.txt:
--------------------------------------------------------------------------------
1 | mongoengine==0.19.1
2 | pymongo==3.10.1
3 | six==1.14.0
4 |
--------------------------------------------------------------------------------
/mongoengine/4-how-to-working-with-index/app.py:
--------------------------------------------------------------------------------
1 | from mongoengine import connect
2 | from odm.posts import Posts
3 |
4 | connect(
5 | db='project1',
6 | host='localhost',
7 | port=27017,
8 | username='mongoadmin',
9 | password='secret',
10 | authentication_source='admin'
11 | )
12 |
13 | post = Posts()
14 | post.title = 'Hello world'
15 | post.url = 'hello-world'
16 | post.content = 'World is nice! :)'
17 | post.status = 'pending'
18 | post.save()
--------------------------------------------------------------------------------
/mongoengine/4-how-to-working-with-index/odm/posts.py:
--------------------------------------------------------------------------------
1 | from mongoengine import Document, StringField, DictField, ListField, DateTimeField
2 |
3 |
4 | class Posts(Document):
5 | title = StringField()
6 | url = StringField()
7 | content = StringField()
8 | metatag = DictField()
9 | categorys = ListField()
10 | authors = ListField()
11 | status = StringField()
12 | updated_at = DateTimeField()
13 | created_at = DateTimeField()
14 |
15 | meta = {
16 | 'auto_create_index': True,
17 | 'index_background': True,
18 | 'indexes': [{
19 | 'name': 'status',
20 | 'fields': ('status', 'created_at', )
21 | }, {
22 | 'name': 'url',
23 | 'fields': ('url', ),
24 | 'unique': True
25 | }]
26 | }
--------------------------------------------------------------------------------
/mongoengine/4-how-to-working-with-index/requirements.txt:
--------------------------------------------------------------------------------
1 | mongoengine==0.19.1
2 | pymongo==3.10.1
3 | six==1.14.0
4 |
--------------------------------------------------------------------------------
/mongoengine/5-how-to-use-custom-field-name-for-collection-and-document-fields/app.py:
--------------------------------------------------------------------------------
1 | from mongoengine import connect
2 | from odm.posts import Posts
3 |
4 | connect(
5 | db='project1',
6 | host='localhost',
7 | port=27017,
8 | username='mongoadmin',
9 | password='secret',
10 | authentication_source='admin'
11 | )
12 |
13 | post = Posts()
14 | post.title = 'Hello world'
15 | post.url = 'hello-world'
16 | post.content = 'World is nice! :)'
17 | post.status = 'pending'
18 | post.save()
--------------------------------------------------------------------------------
/mongoengine/5-how-to-use-custom-field-name-for-collection-and-document-fields/requirements.txt:
--------------------------------------------------------------------------------
1 | mongoengine==0.19.1
2 | pymongo==3.10.1
3 | six==1.14.0
4 |
--------------------------------------------------------------------------------
/mongoengine/6-working-with-embedded-documents-in-mongoengine/app.py:
--------------------------------------------------------------------------------
1 | from mongoengine import connect
2 | from odm.posts import Posts
3 |
4 | connect(
5 | db='project1',
6 | host='localhost',
7 | port=27017,
8 | username='mongoadmin',
9 | password='secret',
10 | authentication_source='admin'
11 | )
12 |
13 | post = Posts()
14 | post.title = 'Hello world'
15 | post.url = 'hello-world'
16 | post.content = 'World is nice! :)'
17 | post.status = 'pending'
18 | post.save()
--------------------------------------------------------------------------------
/mongoengine/6-working-with-embedded-documents-in-mongoengine/requirements.txt:
--------------------------------------------------------------------------------
1 | mongoengine==0.19.1
2 | pymongo==3.10.1
3 | six==1.14.0
4 |
--------------------------------------------------------------------------------
/mongoengine/7-create-document-with-embedded-document-in-mongoengine/requirements.txt:
--------------------------------------------------------------------------------
1 | mongoengine==0.19.1
2 | pymongo==3.10.1
3 | six==1.14.0
4 |
--------------------------------------------------------------------------------
/mongoengine/8-how-to-update-document-with-embedded-documents/requirements.txt:
--------------------------------------------------------------------------------
1 | mongoengine==0.19.1
2 | pymongo==3.10.1
3 | six==1.14.0
4 |
--------------------------------------------------------------------------------
/mongoengine/9-how-to-use-auto-increment-as-primary-in-mongoengine/app.py:
--------------------------------------------------------------------------------
1 | import lib.settings
2 | from odm.posts import Posts
3 | from odm.users import Users
4 |
5 | post = Posts()
6 | post.title = 'test post title'
7 | post.description = 'description for this test post here!'
8 | post.save()
9 |
10 | user = Users()
11 | user.name = 'Paris Nakita Kejser'
12 | user.save()
--------------------------------------------------------------------------------
/mongoengine/9-how-to-use-auto-increment-as-primary-in-mongoengine/lib/settings.py:
--------------------------------------------------------------------------------
1 | from mongoengine import connect
2 |
3 | connect(
4 | db='test',
5 | host='localhost',
6 | port=27017,
7 | username='mongoadmin',
8 | password='secret',
9 | authentication_source='admin'
10 | )
--------------------------------------------------------------------------------
/mongoengine/9-how-to-use-auto-increment-as-primary-in-mongoengine/odm/posts.py:
--------------------------------------------------------------------------------
1 | from mongoengine import Document, StringField, DateTimeField, SequenceField
2 | from datetime import datetime
3 |
4 |
5 | class Posts(Document):
6 | post_id = SequenceField()
7 |
8 | title = StringField()
9 | description = StringField()
10 |
11 | created_at = DateTimeField(default=datetime.utcnow)
12 |
--------------------------------------------------------------------------------
/mongoengine/9-how-to-use-auto-increment-as-primary-in-mongoengine/odm/users.py:
--------------------------------------------------------------------------------
1 | from mongoengine import Document, StringField, DateTimeField, SequenceField
2 | from datetime import datetime
3 |
4 |
5 | class Users(Document):
6 | user_id = SequenceField(primary_key=True)
7 |
8 | name = StringField()
9 |
10 | created_at = DateTimeField(default=datetime.utcnow)
--------------------------------------------------------------------------------
/mongoengine/9-how-to-use-auto-increment-as-primary-in-mongoengine/requirements.txt:
--------------------------------------------------------------------------------
1 | mongoengine==0.19.1
2 | pymongo==3.10.1
3 | six==1.14.0
4 |
--------------------------------------------------------------------------------