worker: Fixed count sites function
This commit is contained in:
parent
dd4d97ffc9
commit
7cddc059b5
@ -67,16 +67,11 @@ def ping():
|
|||||||
return 'pong'
|
return 'pong'
|
||||||
|
|
||||||
def get_sites_count():
|
def get_sites_count():
|
||||||
# If file doesn't exist, create it
|
# Get number of files in nginx/sites
|
||||||
try:
|
dir = os.listdir('/etc/nginx/sites-available')
|
||||||
sites_file = open('sites.txt', 'r')
|
num_Sites = len(dir) - 1
|
||||||
except FileNotFoundError:
|
|
||||||
sites_file = open('sites.txt', 'w')
|
|
||||||
sites_file.close()
|
|
||||||
sites_file = open('sites.txt', 'r')
|
|
||||||
print(sites_file.readlines())
|
|
||||||
# Return number of lines in file
|
# Return number of lines in file
|
||||||
return len(sites_file.readlines())
|
return num_Sites
|
||||||
|
|
||||||
def site_exists(domain):
|
def site_exists(domain):
|
||||||
# If file doesn't exist, create it
|
# If file doesn't exist, create it
|
||||||
|
Loading…
Reference in New Issue
Block a user