To serve Django through Apache, load a mod_wsgi module built for the same Python installation as your virtual environment, route the site to a dedicated mod_wsgi daemon process, map the URL to your project’s wsgi.py, and let Apache serve static and uploaded media files directly. A typical virtual-host configuration uses WSGIDaemonProcess, WSGIProcessGroup, and WSGIScriptAlias; separate Alias rules prevent static-file 404s.
Need a server to try this on? Antihost offers Linux VPS plans with NVMe storage, full root access and a 14-day free trial.
How the Apache–Django request path works
A browser request first reaches Apache. Apache then makes one of two decisions:
As an Amazon Associate I earn from qualifying purchases.
Recommended Free Tools
- Requests matching the Django URL are passed to mod_wsgi, which imports the project’s
wsgi.pymodule and calls the WSGI application. - Requests for static assets or uploaded media are handled by Apache’s ordinary file-serving engine through explicit aliases.
Django’s development server can serve static files during development, but a non-development deployment should not rely on Django for that task. Without Apache aliases (or a separate static-file server), requests for stylesheets, JavaScript, images, and user uploads commonly return 404.
The central mapping is WSGIScriptAlias. It associates a URL prefix, often /, with the absolute path to the project’s WSGI entry point, normally <project>/wsgi.py. Apache passes matching requests to mod_wsgi instead of treating the Python file as a normal document.
#1 Best Overall
- [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
- [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
- [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
- [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
- [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.
Choose daemon mode before writing configuration
Django’s documentation recommends mod_wsgi daemon mode on non-Windows platforms. In daemon mode, mod_wsgi starts dedicated processes for the application and Apache routes the virtual host to that process group. Embedded mode instead loads Python into Apache’s own process space.
| Concern | Daemon mode | Embedded mode |
|---|---|---|
| Process isolation | Dedicated mod_wsgi processes can be assigned to one Django site or process group. | Python runs inside Apache worker processes and shares their process space. |
| Interaction with Apache modules | Application code is separated from Apache’s main worker processes. | Python shares the address space with other loaded Apache modules. |
| Restart and code changes | Daemon processes can be restarted independently of the main Apache workers, reducing the blast radius of an application reload. | Python code changes can require broader Apache process restarts and may increase restart or memory-management costs. |
| Multiple Django sites | Each site can use a distinct process-group name and Python environment. | Applications share Apache’s embedded process space, making isolation harder. |
| Recommended use | Preferred for production and security-sensitive deployments on non-Windows systems. | Useful only when you specifically need embedded behavior and understand the shared-process trade-offs. |
Use a unique daemon-process name for every Django site. The same name must appear in WSGIProcessGroup; a mismatch leaves the virtual host pointing at the wrong group or no intended group at all.
Free tools Windows power users keep installed
One-click scans. No signup required.
Prepare the Python environment and filesystem layout
Match mod_wsgi to Python
mod_wsgi is compiled against a particular base Python installation. The virtual environment named by python-home must have been created with that same base Python version. A virtual environment made from a different Python version can fail during startup even when its packages appear correct.
Install mod_wsgi through your operating system’s Apache package or build it for the Python interpreter that will run the project. Then confirm that Apache actually loads the module before troubleshooting Django imports. A module built for one interpreter cannot safely run a virtual environment created from another.
Rank #2
- 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
- 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
- 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
- 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
- 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.
Use absolute paths
Decide the absolute paths for:
- the virtual-environment prefix, such as
/srv/example/venv; - the directory containing the Django project package, such as
/srv/example; - the project’s WSGI file, such as
/srv/example/mysite/wsgi.py; - the directory populated by
collectstatic; - the directory where uploaded media is stored.
Do not point python-home at the environment’s bin directory. It must point to the virtual-environment prefix itself. The python-path value must contain the directory from which the Django project package can be imported; in the example above, that is /srv/example, not merely the directory containing wsgi.py.
Keep code, static files, and media distinct
A practical layout separates application code from generated or user-writable files. For example, keep the project package below /srv/example/mysite, collect static files into a dedicated directory such as /srv/example/staticfiles, and store uploads below a separate media directory. This makes Apache access rules easier to audit and prevents a user upload from being mistaken for executable application code.
Build the daemon-mode virtual-host configuration
The following is a representative configuration. Replace every path and hostname with values from your deployment:
WSGIDaemonProcess example.com python-home=/srv/example/venv python-path=/srv/example
WSGIProcessGroup example.com
WSGIScriptAlias / /srv/example/mysite/wsgi.py
<Directory /srv/example/mysite>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
Alias /static/ /srv/example/staticfiles/
<Directory /srv/example/staticfiles/>
Require all granted
</Directory>
Alias /media/ /srv/example/media/
<Directory /srv/example/media/>
Require all granted
</Directory>
What each directive does
WSGIDaemonProcess example.comdefines a dedicated daemon process group. The name is arbitrary, but it must be unique on the server and reused exactly byWSGIProcessGroup.python-home=/srv/example/venvselects the virtual-environment prefix. It supplies the environment’s installed packages while retaining the Python version with which mod_wsgi was compiled.python-path=/srv/exampleadds the project’s import root to Python’s module search path. Without it, imports such asimport mysitecan fail even though the files exist.WSGIProcessGroup example.comroutes this virtual host to the named daemon group.WSGIScriptAlias / /srv/example/mysite/wsgi.pymaps the site root to the WSGI application. A different URL base can be used, but the prefix and the Django deployment’s URL expectations must agree.<Directory>and<Files wsgi.py>grant Apache permission to access the WSGI entry point without opening the whole project tree as a public document directory.Alias /static/andAlias /media/map public URL prefixes to real filesystem directories. Their corresponding<Directory>blocks grant Apache access to those roots.
When to use WSGIPythonHome
For a simple setup, Apache can use the global WSGIPythonHome setting to identify a Python installation. In daemon mode, the per-process python-home option is normally the clearer choice because each daemon group can select its own virtual environment. Do not assume that setting a global Python home automatically supplies the project’s import path; python-path still needs to point at the directory containing the Django package.
Rank #3
- [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
- [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
- [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
- [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
- [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by
Connect Apache to the correct wsgi.py
Django creates a WSGI entry point in the project package, commonly at mysite/wsgi.py. That file should expose the WSGI application object generated by the project. The path in WSGIScriptAlias must match the file that actually exists on disk.
- Verify the file exists at the exact absolute path used in the directive.
- Verify the project package can be imported when the project directory is on Python’s search path.
- Ensure the Apache service account can traverse each parent directory and read the WSGI file.
- Keep the
<Files wsgi.py>rule inside a narrowly scoped<Directory>block. - After changing the alias, validate Apache’s configuration before reloading it.
The handler binding is important. If configuration changes accidentally break the WSGI handler association, Apache can fall back to treating a .py file as a static file. That is both a security problem and a clear sign that the alias or module configuration is no longer being applied.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallServe static files and uploaded media correctly
Collect static files into one directory
Set Django’s static-files destination to a directory that Apache can read, then run the project’s collectstatic operation during deployment. The resulting directory should contain Django’s admin assets as well as assets from your installed applications. The admin interface is not an exception: its CSS and JavaScript also need an Apache-visible static path.
The URL prefix and filesystem path must line up. If Django emits URLs beginning with /static/, Apache needs an Alias /static/ ... rule. A mismatch such as /assets/ in one place and /static/ in another produces 404s even when the files were collected successfully.
Rank #4
- Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
- Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
- All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
- Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
- Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.
Expose media separately
User uploads belong under a media URL and media filesystem root, not inside the source-code directory. Add a separate Alias /media/ rule and a matching <Directory> access block. Confirm that the Apache service account can read the files and traverse the directory tree. If uploads are intentionally writable by another service account, grant only the minimum read access Apache requires.
Diagnose a static-file 404
- Inspect the browser’s failed URL and note whether it begins with the configured static or media prefix.
- Check that the corresponding file exists below the target directory, including case-sensitive spelling.
- Confirm that
collectstaticcompleted and that the admin static files were included. - Check the
Aliasspelling, trailing slashes, and the order of Apache rules. - Check filesystem permissions and directory traversal permissions for the Apache service account.
- Review Apache’s error log before changing Django templates or application code.
Apply security and operational controls
Limit what Apache can read
Grant access only to the WSGI script and the static/media roots needed by the site. Do not broadly expose the directory that contains settings, deployment files, virtual-environment metadata, or secrets. The WSGI entry point needs read access; the rest of the source tree does not need to become a document root.
Run under an appropriate service account
Apache should run under its configured service account rather than as an unrestricted administrative user. Ensure that account can read the application and static files, traverse their parent directories, and write only to locations that genuinely require writes. Keep secret values in the deployment environment or another protected mechanism instead of placing them in publicly readable files.
Isolate applications
Use one daemon process group per Django site. This keeps Python environments and process lifecycles separate and makes it possible to restart or troubleshoot one application without intentionally combining it with another. Give each group a descriptive, stable name and use that exact name in the virtual host’s WSGIProcessGroup.
Best Value
Reload deliberately
After editing Apache configuration, run its configuration check first. If validation succeeds, reload Apache using the service-management method provided by your operating system. A failed validation should be fixed before any reload attempt; otherwise, the running service may continue using an older configuration while the files on disk suggest something else.
Troubleshoot startup, import, and routing failures
| Symptom | Likely cause | Checks and corrective action |
|---|---|---|
| Apache will not load mod_wsgi | The module is missing or was compiled for a different Python version. | Confirm the module is loaded and that its build-time Python matches the virtual environment’s base Python. |
| Import error for the Django project | python-path points to the wrong directory. |
Set it to the directory from which the project package imports, not simply the directory containing wsgi.py. |
| Environment packages are missing | python-home is absent, points at the wrong environment, or points at bin. |
Use the virtual-environment prefix and confirm the environment was created from the same Python version as mod_wsgi. |
| Permission denied for the WSGI file | The file rule or parent-directory permissions do not grant Apache access. | Verify the absolute path, the <Directory>/<Files> block, and traversal permissions. |
| Requests reach the wrong process group | The names in WSGIDaemonProcess and WSGIProcessGroup differ. |
Make the names identical and unique for the site. |
| Python source is downloaded or displayed | The WSGI handler binding was lost and Apache is serving the file as static content. | Restore the mod_wsgi load and WSGIScriptAlias configuration immediately; do not expose the file while investigating. |
| Static and admin assets return 404 | Missing alias, incorrect collected-files directory, or insufficient permissions. | Check the URL prefix, run collectstatic, verify the alias target, and inspect Apache’s log. |
| Application returns a generic 500 error | Startup exception, import failure, incompatible environment, or settings problem. | Read Apache and mod_wsgi error logs first. They usually identify whether the failure occurred before Django handled the request. |
A deployment checklist
- mod_wsgi is loaded by Apache and was compiled for the Python version used by the virtual environment.
- The daemon’s
python-homeis the environment prefix, not itsbindirectory. python-pathcontains the project import root.- The
wsgi.pyfile exists at the exact path inWSGIScriptAlias. - The WSGI file’s narrowly scoped directory and file rules grant Apache access.
- The
WSGIProcessGroupname exactly matches the daemon-process name. - Static and media aliases point to the intended directories.
collectstatichas populated the static directory, including admin assets.- Apache can read static/media files and traverse their parent directories.
- Secrets are supplied through protected deployment configuration.
- Apache and mod_wsgi error logs have been checked before changing application code.
Embedded mode: when it may still be appropriate
Embedded mode is not an automatic configuration error, but it places Python inside Apache’s worker processes and shares memory and process state with other Apache modules. That can make restarts more disruptive and memory behavior harder to reason about, especially when several Python applications share the server. If you select embedded mode, document why it is required, test its restart behavior, and avoid assuming that settings designed for daemon groups—particularly per-site isolation—apply unchanged.
For a conventional production deployment on a non-Windows platform, daemon mode provides the cleaner boundary: a dedicated process group, an explicit virtual environment, and a direct mapping between each virtual host and its Django application.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




