Python Apps Specifications

Python Application Specifications

A Python project should follow the platform application-package requirements before it is uploaded or deployed from a remote repository. The project must include the application source, a dependency declaration, and a valid WSGI entry point for Apache Python.

Application Package Structure

Keep the application files at the root level of the deployment package. The platform must be able to find the dependency file and the WSGI entry point after extracting the archive.

my-python-application/
├── requirements.txt
├── wsgi.py
├── application/
│   ├── __init__.py
│   ├── views.py
│   └── settings.py
├── static/
├── templates/
└── other project files
!

Avoid an unnecessary wrapper directory

When the archive is extracted, the application files should not be hidden inside an extra top-level folder that prevents the platform from locating requirements.txt or wsgi.py.

Dependency Specification

List all required Python modules in a project-level requirements.txt file. The platform reads this file during deployment and installs the declared packages automatically with pip.

Django==5.2
mysqlclient==2.2.7
requests==2.32.4
File namerequirements.txt
LocationApplication package root
PurposeDeclares the modules required by the application
InstallationProcessed automatically during deployment

Use compatible package versions

Confirm that every listed dependency supports the Python engine version selected for the environment, especially packages that compile native extensions.

WSGI Entry Point

Apache Python uses the mod_wsgi module to start the application. The deployment package should therefore include a wsgi.py file with a callable application entry point.

Basic WSGI Example

def application(environ, start_response):
    status = "200 OK"
    output = b"Python application is running."

    response_headers = [
        ("Content-Type", "text/plain"),
        ("Content-Length", str(len(output))),
    ]

    start_response(status, response_headers)
    return [output]

Django WSGI Example

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault(
    "DJANGO_SETTINGS_MODULE",
    "application.settings",
)

application = get_wsgi_application()

The callable should normally be named application so the application server can load it through WSGI.

Archive Preparation

  • Package the project as a supported application archive.
  • Place the application files directly at the archive root.
  • Include requirements.txt.
  • Include the WSGI entry-point file.
  • Include templates, static resources, migrations, and other files required at runtime.
  • Do not include local virtual-environment directories unless explicitly required by the deployment design.
  • Do not include passwords, access tokens, or private keys in the archive.
i

Environment-specific settings

Store database credentials, external-service URLs, API keys, and application modes in environment variables or protected configuration instead of hardcoding them into the deployment package.

Deployment Behavior

When an archive or repository is deployed to Apache Python, the platform performs the following high-level actions:

Source preparationExtracts or checks out the application files.
Dependency installationReads requirements.txt and installs the listed modules.
Application startupLoads the WSGI entry point through Apache and mod_wsgi.
LoggingWrites deployment and runtime messages to the environment logs.

For scaled application-server layers, deployment can be performed simultaneously or sequentially. Sequential deployment can help reduce interruption by updating the nodes one at a time.

Pre-Deployment Checklist

  • The selected Python engine is compatible with the project.
  • requirements.txt is present at the package root.
  • The WSGI entry point is present and exposes an application callable.
  • All import paths are valid after archive extraction.
  • Static files and templates are included.
  • Database settings use the correct internal host and credentials.
  • Secrets are stored outside the source package.
  • The project has been tested using the same Python major and minor version.

Expected Result

The application package is accepted by the deployment process, required modules are installed from requirements.txt, and Apache Python starts the project through its WSGI entry point.

Common Issues and Solutions

requirements.txt is not detectedMove the file to the archive root and remove any unnecessary wrapper directory.
WSGI application cannot be loadedCheck the entry-point filename, callable name, project import paths, and framework settings module.
Dependency installation failsReview package versions, Python compatibility, native-library requirements, and deployment logs.
Application imports fail after deploymentVerify that all source directories are included and that imports do not depend on local development paths.
Application starts but returns an errorReview environment variables, database connectivity, framework configuration, Apache logs, and application logs.