Skip to content

Commit 6f0f888

Browse files
committed
Add Flask_Directory_Initiator
1 parent c44e697 commit 6f0f888

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Script to initiate flask directory
2+
3+
## How This works
4+
5+
1. Create and activate a virtual environment.
6+
2. Run `pip install -r requirements.txt`
7+
1. Run `python3 flask_init.py`
8+
2. Input the name of the project
9+
3. Input a directory to store your project
10+
11+
A new flask project directory will be created with a virtual environment inside your project.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import os
2+
import sys
3+
import virtualenv
4+
5+
print("Project Name:")
6+
name = input()
7+
print("Directory(Valid) to store the project:")
8+
loc = input()
9+
#if invalid directory, stops the program
10+
if(os.path.isdir(loc)!=True):
11+
print("Invalid Directory")
12+
sys.exit()
13+
14+
os.chdir(loc)
15+
os.makedirs(name)
16+
loc = loc + '/' + name
17+
os.chdir(loc)
18+
sys.argv = [sys.argv[0],'env']
19+
#creates a virtualenv with the name env
20+
virtualenv.cli_run({sys.argv[1]})
21+
open('run.py','a').close()
22+
open('config.py','a').close()
23+
commands = ['app','instance','app/static','app/templates']
24+
for i in commands:
25+
os.makedirs(i)
26+
os.chdir(loc+'/app')
27+
open('__init__.py','a').close()
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
appdirs==1.4.4
2+
distlib==0.3.1
3+
filelock==3.0.12
4+
six==1.15.0
5+
virtualenv==20.0.33

0 commit comments

Comments
 (0)