You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`FLASK_PROJECT`| Yes || The sub-directory name under `/shared/httpd/` to serve [1]|
106
+
|`FLASK_APP_DIR`||`app`| The main entrypoint dir name |
107
+
|`FLASK_APP_FILE`||`main.py`| The main entrypoint file name |
108
+
|`FLASK_PORT`||`3000`| Docker container internal http port to serve the application |
109
+
|`NEW_UID`||`1000`| User id of the host system to ensure syncronized permissions between host and container |
110
+
|`NEW_GID`||`1000`| Group id of the host system to ensure syncronized permissions between host and container |
62
111
63
112
*[1] See [Project directory structure](#project-directory-structure) for usage
64
113
@@ -72,21 +121,22 @@ The following shows how to organize your project on the host operating system.
72
121
The following is the least required directory structure:
73
122
```bash
74
123
<project-dir>/
75
-
└── app #Must be named 'app'
76
-
└── main.py # Entrypoint name can be changed via env var [1]
124
+
└── app #Entrypoint dir name can be changed via env var [1]
125
+
└── main.py # Entrypoint file name can be changed via env var [2]
77
126
```
78
127
79
-
*[1] Use the `FLASK_APP` environment variable to defined the file for the entrypoint in `<project-dir>/app/`. Example: `FLASK_APP=test.py`.
128
+
*[1] Use the `FLASK_APP_DIR` environment variable to define the dir for the entrypoint in `<project-dir>/app/`. Example: `FLASK_APP_DIR=src`.
129
+
*[2] Use the `FLASK_APP_FILE` environment variable to define the file for the entrypoint in `<project-dir>/app/main.py`. Example: `FLASK_APP_FILE=test.py`.
80
130
81
131
82
132
### Structure with dependencies
83
133
84
134
The following directory structure allows for auto-installing Python dependencies during startup into a virtual env.
85
135
```bash
86
136
<project-dir>/
87
-
├── app #Must be named 'app'
137
+
├── app #Entrypoint dir name can be changed via env var
88
138
│ ├── __init__.py
89
-
│ └── main.py # Entrypoint name can be changed via env var
139
+
│ └── main.py # Entrypoint file name can be changed via env var
90
140
└── requirements.txt # Optional: will pip install in virtual env
>&2echo"Error, <project> directory does not exist: ${PROJECT}."
70
-
exit 1
110
+
>&2echo"[WARN] <project> directory does not exist: ${PROJECT}"
71
111
fi
72
112
73
113
###
74
114
### Check project/app directory
75
115
###
76
-
if [ !-d"${PROJECT}/app" ];then
77
-
>&2echo"Error, <project>/app directory does not exist: ${PROJECT}/app."
78
-
exit 1
116
+
if [ !-d"${PROJECT}/${DEFAULT_FLASK_APP_DIR}" ];then
117
+
>&2echo"[WARN] <project>/${DEFAULT_FLASK_APP_DIR} directory does not exist: ${PROJECT}/${DEFAULT_FLASK_APP_DIR}"
79
118
fi
80
119
81
120
82
121
###
83
122
### Check Entrypoint file
84
123
###
85
-
if [ !-f"${PROJECT}/app/${DEFAULT_FLASK_APP}" ];then
86
-
>&2echo"Error, <project>/app/${DEFAULT_FLASK_APP} entrypoint file does not exist: ${PROJECT}/app/${DEFAULT_FLASK_APP}."
87
-
exit 1
124
+
if [ !-f"${PROJECT}/${DEFAULT_FLASK_APP_DIR}/${DEFAULT_FLASK_APP_FILE}" ];then
125
+
>&2echo"[WARN] <project>/${DEFAULT_FLASK_APP_DIR}/${DEFAULT_FLASK_APP_FILE} entrypoint file does not exist: ${PROJECT}/${DEFAULT_FLASK_APP_DIR}/${DEFAULT_FLASK_APP_FILE}"
0 commit comments