### Install Application Source: https://github.com/azure-samples/azure-fastapi-postgres-flexible-appservice/blob/main/README.md Installs the application as an editable package, allowing for local development and testing. ```python python3 -m pip install -e src ``` -------------------------------- ### Install Production Requirements Source: https://github.com/azure-samples/azure-fastapi-postgres-flexible-appservice/blob/main/README.md Installs the necessary Python packages for the application to run in a production environment. ```python python3 -m pip install -r src/requirements.txt ``` -------------------------------- ### Local PostgreSQL Setup Source: https://github.com/azure-samples/azure-fastapi-postgres-flexible-appservice/blob/main/README.md Sets environment variables for connecting to a local PostgreSQL database. Ensure you replace placeholders with your actual database credentials. ```shell export POSTGRES_HOST=localhost export POSTGRES_PORT=5432 export POSTGRES_DATABASE= export POSTGRES_USERNAME= export POSTGRES_PASSWORD= ``` -------------------------------- ### HTML Form for Cruise Information Request Source: https://github.com/azure-samples/azure-fastapi-postgres-flexible-appservice/blob/main/src/templates/info_request_create.html This HTML template defines a form for users to request information about cruises. It includes fields for name, email, cruise selection, and notes. The cruise options are dynamically populated from a list of cruises. ```html {% extends 'base.html' %} {% block title %} ReleCloud - Request information {% endblock title %} {% block content %} Request information =================== {% if message %} {{ message }} {% endif %} Fill out the form below to request information about our cruises Name: Email: Cruise: {% for cruise in cruises %} {{ cruise.name }} {% endfor %} Notes: Save {% endblock content %} ``` -------------------------------- ### Install Development Requirements and Playwright Source: https://github.com/azure-samples/azure-fastapi-postgres-flexible-appservice/blob/main/README.md Installs development dependencies and Playwright browsers for running automated tests. ```python python3 -m pip install -r requirements-dev.txt python3 -m playwright install chromium --with-deps ``` -------------------------------- ### Run FastAPI Application Locally Source: https://github.com/azure-samples/azure-fastapi-postgres-flexible-appservice/blob/main/README.md Starts the FastAPI application using uvicorn for local development. The --reload flag enables automatic restarts on code changes. ```python python3 -m uvicorn fastapi_app:app --reload --port=8000 ``` -------------------------------- ### HTML Structure and Jinja Templating Source: https://github.com/azure-samples/azure-fastapi-postgres-flexible-appservice/blob/main/src/templates/base.html This snippet shows the basic HTML structure of the web page, including navigation links, content placeholders, and Jinja2 templating for dynamic content rendering. It also includes basic CSS for styling the primary button. ```HTML {% block title %} ReleCloud - Expand your horizons {% endblock %} Rocket ship logo

ReleCloud Space Tourism

Cartoon raccoon floating in space

Expand your horizons

{% if messages %} {% for message in messages %}

{{ message }}

{% endfor %} {% endif %} Astronaut looking into space {% block content %}

Lorem Ipsum Dolor

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

{% endblock %} ``` -------------------------------- ### Project Dependencies (requirements.txt) Source: https://github.com/azure-samples/azure-fastapi-postgres-flexible-appservice/blob/main/requirements-dev.txt Lists the Python packages required for the FastAPI application, including testing and linting tools. ```python cruft pip-tools pytest ephemeral-port-reserve pytest-playwright coverage pytest-cov axe-playwright-python ruff ``` -------------------------------- ### Rebase and Force Push Git Commands Source: https://github.com/azure-samples/azure-fastapi-postgres-flexible-appservice/blob/main/CONTRIBUTING.md Demonstrates the Git commands for rebasing your fork and force pushing changes to update a Pull Request. ```shell git rebase master -i git push -f ``` -------------------------------- ### Provision and Deploy Azure Resources Source: https://github.com/azure-samples/azure-fastapi-postgres-flexible-appservice/blob/main/README.md Provisions and deploys all necessary Azure resources and the application using the Azure Developer CLI. ```shell azd up ``` -------------------------------- ### Configure CI/CD Pipeline Secrets Source: https://github.com/azure-samples/azure-fastapi-postgres-flexible-appservice/blob/main/README.md Configures the necessary Azure authentication secrets for the GitHub Actions CI/CD workflow. ```shell azd pipeline config ``` -------------------------------- ### Run Tests Source: https://github.com/azure-samples/azure-fastapi-postgres-flexible-appservice/blob/main/README.md Executes the project's test suite using pytest. ```python python3 -m pytest ``` -------------------------------- ### Apply Migrations and Seed Data Source: https://github.com/azure-samples/azure-fastapi-postgres-flexible-appservice/blob/main/README.md Applies database migrations and populates the database with initial data using a Python script. ```python python3 src/fastapi_app/seed_data.py ``` -------------------------------- ### Azure Developer CLI Login Source: https://github.com/azure-samples/azure-fastapi-postgres-flexible-appservice/blob/main/README.md Logs the Azure Developer CLI into your Azure account. ```shell azd auth login ``` -------------------------------- ### HTML Template for Destination Details Source: https://github.com/azure-samples/azure-fastapi-postgres-flexible-appservice/blob/main/src/templates/destination_detail.html This HTML template extends a base template to display destination information and a list of associated cruises. It uses Jinja2 templating for dynamic content rendering, including loops and URL generation. ```html {% extends 'base.html' %} {% block title %} ReleCloud - {{ destination }} {% endblock %} {% block content %} {{ destination }} ================= {{ destination.description }} You can explore {{ destination }} on the following cruises: {% for cruise in cruises %} [{{cruise}}]({{ url_for('cruise_detail', pk=cruise.id) }}) {% endfor %} {% endblock %} ``` -------------------------------- ### HTML Template for Cruise Details Source: https://github.com/azure-samples/azure-fastapi-postgres-flexible-appservice/blob/main/src/templates/cruise_detail.html This HTML template displays cruise information, including its name, description, and a list of destinations. It uses Jinja2 templating for dynamic content rendering. ```html {% extends 'base.html' %} {% block title %} ReleCloud - {{ cruise }} {% endblock %} {% block content %} {{ cruise }} ============ {{ cruise.description }} This cruise visits the following destinations: {% for destination in cruise.destinations %} [{{ destination }}]({{ url_for('destination_detail', pk=destination.id) }}) {% endfor %} {% endblock content %} ``` -------------------------------- ### Run Smoke Tests Source: https://github.com/azure-samples/azure-fastapi-postgres-flexible-appservice/blob/main/src/tests/smoke/README.md Executes the project's smoke tests using pytest against a live server URL. This command is typically used in CI/CD pipelines or for verifying a deployed application. ```bash python3 -m pytest --exitfirst src/tests/smoke/smoketests.py --live-server-url $URI ``` -------------------------------- ### HTML Template for Cruise Destinations Source: https://github.com/azure-samples/azure-fastapi-postgres-flexible-appservice/blob/main/src/templates/destinations.html This HTML template extends a base template and displays a list of cruise destinations fetched from the backend. It uses Jinja2 templating to iterate over destinations and create links to their detail pages. ```html {% extends 'base.html' %} {% block title %} ReleCloud - Destinations {% endblock %} {% block content %} Cruise destinations =================== If you can imagine it, we travel to it! Below is our list of confirmed destinations. {% for destination in destinations %} [{{ destination }}]({{ url_for('destination_detail', pk=destination.id) }}) {% endfor %} {% endblock content %} ``` -------------------------------- ### HTML Base Template Source: https://github.com/azure-samples/azure-fastapi-postgres-flexible-appservice/blob/main/src/templates/about.html This is the base HTML template for the application, defining the structure and blocks for content. ```html {% extends 'base.html' %} {% block title %} ReleCloud - About {% endblock %} {% block content %} About ReleCloud =============== Formed in 2021, ReleCloud is a Redmond, WA based company with our head in the clouds - or stars really. We want to offer people the best possible experience for passengers exploring space. {% endblock content %} ``` -------------------------------- ### Deploy Application Changes Source: https://github.com/azure-samples/azure-fastapi-postgres-flexible-appservice/blob/main/README.md Deploys any changes made to the application code to Azure using the Azure Developer CLI. ```shell azd deploy ``` -------------------------------- ### Reporting Security Issues to Microsoft Source: https://github.com/azure-samples/azure-fastapi-postgres-flexible-appservice/blob/main/SECURITY.md Provides instructions on how to report security vulnerabilities to Microsoft's Security Response Center (MSRC). It details preferred communication channels, including email and a web form, and specifies the information required for a comprehensive report. ```APIDOC Reporting Security Issues: Do not report security vulnerabilities through public GitHub issues. Preferred Method: - Report to Microsoft Security Response Center (MSRC) at https://msrc.microsoft.com/create-report Alternative Method (without login): - Send email to secure@microsoft.com - Encrypt message with PGP key from https://www.microsoft.com/en-us/msrc/pgp-key-msrc Response Time: - Expect a response within 24 hours. - Follow up via email if no response is received. Additional Information: - Visit https://www.microsoft.com/msrc for more details. Information to Include in Report: - Type of issue (e.g., buffer overflow, SQL injection, cross-site scripting) - Full paths of source files related to the issue - Location of affected source code (tag/branch/commit or direct URL) - Special configuration required for reproduction - Step-by-step instructions to reproduce the issue - Proof-of-concept or exploit code (if possible) - Impact of the issue and how an attacker might exploit it Bug Bounty Program: - Visit https://www.microsoft.com/msrc/bounty for details on active programs. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.