Switch from os to pathlib because it's more modern i guess?
				
					
				
			(Resolves #19)
This commit is contained in:
		@ -1,4 +1,4 @@
 | 
			
		||||
import os
 | 
			
		||||
from pathlib import Path
 | 
			
		||||
from .core import app
 | 
			
		||||
 | 
			
		||||
# Start the flask server if run from terminal
 | 
			
		||||
@ -14,7 +14,7 @@ if __name__ == "__main__":
 | 
			
		||||
 | 
			
		||||
		# Prettier URLs by auto-loading <path>.html
 | 
			
		||||
		# Our nginx config does this as well
 | 
			
		||||
		if not os.path.isfile(fpath):
 | 
			
		||||
		if not Path(fpath).is_file():
 | 
			
		||||
			return app.send_static_file(path + '.html')
 | 
			
		||||
 | 
			
		||||
		return app.send_static_file(path)
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,5 @@
 | 
			
		||||
import sys, os
 | 
			
		||||
import sys
 | 
			
		||||
from pathlib import Path
 | 
			
		||||
from configparser import ConfigParser
 | 
			
		||||
 | 
			
		||||
class Config:
 | 
			
		||||
@ -8,9 +9,9 @@ class Config:
 | 
			
		||||
		def findConfigFile():
 | 
			
		||||
			if len(sys.argv) > 1:
 | 
			
		||||
				return sys.argv[1]
 | 
			
		||||
			elif os.path.isfile('config.ini'):
 | 
			
		||||
			elif Path('config.ini').is_file():
 | 
			
		||||
				return 'config.ini'
 | 
			
		||||
			elif os.path.isfile('/etc/ftracker/config.ini'):
 | 
			
		||||
			elif Path('/etc/ftracker/config.ini').is_file():
 | 
			
		||||
				return '/etc/ftracker/config.ini'
 | 
			
		||||
			else:
 | 
			
		||||
				return None
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user