https://github.com/cheesecake87/flask-example-sub-domain
Contains a working example of using Sub Domains in Flask.
https://github.com/cheesecake87/flask-example-sub-domain
example flask guide python tutorial
Last synced: 7 months ago
JSON representation
Contains a working example of using Sub Domains in Flask.
- Host: GitHub
- URL: https://github.com/cheesecake87/flask-example-sub-domain
- Owner: CheeseCake87
- License: cc0-1.0
- Created: 2023-01-29T21:04:55.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-11-28T15:19:18.000Z (about 1 year ago)
- Last Synced: 2025-06-24T00:06:04.594Z (8 months ago)
- Topics: example, flask, guide, python, tutorial
- Language: Python
- Homepage:
- Size: 39.1 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# EXA-Sub-Domain
(EXA, Example)
Contains a working example of using Sub Domains.
### Setup
(This assumes you have Python installed)
1. Download or Clone this repository.
2. Open terminal (Linux) / powershell (Windows) and cd to the directory of the project.
```text
# Linux
cd /path/to/EXA-Sub-Domain
# Windows
cd C:\path\to\EXA-Sub-Domain
```
---
### Linux
**Create a virtual environment and activate it.**
```bash
python3 -m venv venv
```
```bash
source venv/bin/activate
```
**Install the requirements.**
```bash
pip install -r requirements.txt
```
**run**
```bash
flask run
```
or
```bash
python3 run.py
```
---
### Windows
**Create a virtual environment and activate it.**
```bash
python -m venv venv
```
```bash
.\venv\Scripts\activate
```
**Install the requirements.**
```bash
pip install -r requirements.txt
```
**run**
```bash
flask run
```
or
```bash
python run.py
```
---
### Post Setup
Add the following to your `hosts` file:
```bash
127.0.0.1 site.local
127.0.0.1 subdomain.site.local
127.0.0.1 blueprint.site.local
```
Visit `http://site.local:5000`, `http://subdomain.site.local:5000` and
`http://blueprint.site.local:5000` to see the results.
**Linux most common `hosts` file location**
`/etc/hosts`
(open with sudo if needed, edit, then save)
**Windows `hosts` file location**
`c:\Windows\System32\drivers\etc\hosts`
(copy to desktop, edit, then paste back to folder)