pull/109/head
Mr Chen 6 years ago
parent 78d8876393
commit 777566ec54
  1. 9
      class/core/config_api.py
  2. 13
      class/core/public.py
  3. 1
      data/site.pl
  4. 2
      route/templates/default/config.html

@ -58,6 +58,9 @@ class config_api:
port = request.form.get('port', '')
host_ip = request.form.get('host_ip', '')
domain = request.form.get('domain', '')
sites_path = request.form.get('sites_path', '')
backup_path = request.form.get('backup_path', '')
if domain != '':
reg = "^([\w\-\*]{1,100}\.){1,4}(\w{1,10}|\w{1,10}\.\w{1,10})$"
if not re.match(reg, domain):
@ -69,6 +72,12 @@ class config_api:
if webname != public.getConfig('title'):
public.setConfig('title', webname)
if sites_path != public.getWwwDir():
public.setWwwDir(sites_path)
if backup_path != public.getWwwDir():
public.setBackupDir(backup_path)
if port != public.getHostPort():
import system_api
public.setHostPort(port)

@ -55,9 +55,17 @@ def getServerDir():
def getWwwDir():
file = getRunDir() + '/data/site.pl'
if os.path.exists(file):
return readFile(file).strip()
return getRootDir() + '/wwwroot'
def setWwwDir(wdir):
file = getRunDir() + '/data/site.pl'
return writeFile(file, wdir)
def getLogsDir():
return getRootDir() + '/wwwlogs'
@ -66,6 +74,11 @@ def getBackupDir():
return getRootDir() + '/backup'
def setBackupDir(bdir):
file = getRunDir() + '/data/backup.pl'
return writeFile(file, wdir)
def getOs():
return sys.platform

@ -0,0 +1 @@
/Users/midoks/Desktop/fwww/wwwroot

@ -66,7 +66,7 @@
<p class="mtb15">
<span class="set-tit text-right" title="默认建站目录">默认备份目录</span>
<input name="sites_path" class="inputtxt bt-input-text" type="text" value="{{data['backup_path']}}">
<input name="backup_path" class="inputtxt bt-input-text" type="text" value="{{data['backup_path']}}">
<span class="set-info c7">网站和数据库的备份目录!</span>
</p>

Loading…
Cancel
Save