def script_path(script_dir): """ Context manager for adding a dir to the sys path and restoring it afterwards. This trick allows relative imports to work on the target script. if script_dir is empty function will do nothing Slightly modified from wolf's script_path (see https://github.com/Duroktar/Wolf) Exception-safe (os.error will not be raised) """ if script_dir is None or script_dir == "": yield else: try: original_cwd = os.getcwd() os.chdir(script_dir) path.insert(1, script_dir) except os.error: # no idea why this would happen but a user got this error once # this func is not critical to arepl so we dont want error to bubble up pass try: yield finally: try: os.chdir(original_cwd) path.remove(script_dir) except (os.error, ValueError): pass
def extension(buildout): def setup(name, *args, **kw): buildout["buildout"].setdefault("package-name", name) # monkey-patch `setuptools.setup` with the above... import setuptools original = setuptools.setup setuptools.setup = setup # now try to import `setup.py` from the current directory, extract # the package name using the helper above and set `package-name` # in the buildout configuration... here = abspath(curdir) path.insert(0, here) import setup # mention `setup` again to make pyflakes happy... :p setup # reset `sys.path` and undo the above monkey-patch path.remove(here) setuptools.setup = original # if there's a `setup.py` in the current directory # we also want to develop this egg... # print buildout['buildout'] buildout["buildout"].setdefault("develop", ".") return buildout
def execfile(filename, globals=None, locals=None): f = open(filename, "rb") content = f.read() f.close() if globals is None: globals = {} globals["__file__"] = filename globals["__name__"] = "__main__" file_path = split(filename)[0] if not file_path: file_path = getcwd() new_path = file_path not in py_path if new_path: py_path.append(file_path) try: exec(content, globals, locals) finally: if new_path: py_path.remove(file_path)
def importFromPath(path, memberName=None): scriptDir, scriptName = splitPath(path) moduleName = rootFileName(scriptName) sysPath.append(scriptDir) if memberName is None: exec(__IMPORT_TMPLT % (moduleName, )) else: exec(__FROM_IMPORT_TMPLT % (moduleName, memberName)) sysPath.remove(scriptDir) return locals()[memberName] if memberName else locals()[moduleName]
def fixPath() : from sys import path from os import getcwd, chdir for x in path : if x.lower() == 'c:\\windows\\system32' or x.lower() == 'c:\\winnt\\system32' : path.remove(x) x = getcwd().lower() if x == 'c:\\windows\\system32' or x == 'c:\\winnt\\system32' : chdir('c:\\')
def return_module(self, name='test'): file_name = path.join(self.out_dir.name, name + '.py') sys_path.append(self.out_dir.name) loader = SourceFileLoader(self._testMethodName, file_name) module = loader.load_module(self._testMethodName) sys_path.remove(self.out_dir.name) return module
def unregister(): unregister_class(BakeMIDI) unregister_class(SD_MIDIFilesPanel) # remove sfm from sys if len(smf_paths): from sys import path for p in smf_paths: if p in path: path.remove(p) smf_paths.remove(p)
def _reimport(update=False): """ Internal function for serves symbols correspondences """ from os import path p = path.dirname(path.abspath(__file__)) if update == True: from sys import path as pth pth.insert(1, p) import up up.update_currencies() pth.remove(p) if '' in pth: pth.remove('') with open(p + '/tmp/symbols.txt', 'r') as f: availables = f.read() from ast import literal_eval as l return l(availables)
def extension(buildout): # A dictionary containing the setuptools name and the name as it's # buildout equivalent. supported_args = {'name': 'package-name', 'description': 'package-description', 'author': 'package-author', 'author_email': 'package-author-email', 'version': 'package-version'} def setup(**args): """Processes passed args and if they are supported, adds them as default values to buildout. Arguments: args: The arguments to process. """ for arg in filter(lambda arg: arg in supported_args, args): buildout['buildout'].setdefault(supported_args[arg], args[arg]) # monkey-patch `setuptools.setup` with the above... import setuptools original = setuptools.setup setuptools.setup = setup # now try to import `setup.py` from the current directory, extract # the package name using the helper above and set `package-name` # in the buildout configuration... here = abspath(curdir) path.insert(0, here) import setup # mention `setup` again to make pyflakes happy... :p setup # reset `sys.path` and undo the above monkey-patch path.remove(here) setuptools.setup = original # if there's a `setup.py` in the current directory # we also want to develop this egg... # print buildout['buildout'] buildout['buildout'].setdefault('develop', '.') return buildout
def handle_task(ppipe): display( OUTPUT_DEBUG, 'unpickling the connection' ) upw = pickle.loads(ppipe) # unpickled writer pipe = upw[0](upw[1][0],upw[1][1],upw[1][2]) task = None try: root = pipe.recv() if path.count( root ) == 0: display( OUTPUT_DEBUG, 'updated path' ) path.insert( 0, root ) files = listdir( root ) for f in files: #print f if f.endswith( '.py' ): module = __import__( f.split('.')[0] ) reload( module ) task = pipe.recv() display( OUTPUT_DEBUG, 'process pool running task %s' % task.id() ) task.execute() if path.count( root ) > 0: display( OUTPUT_DEBUG, 'removing path from process' ) path.remove( root ) except: displayExcept() if task == None: display( OUTPUT_ERROR, 'process in pool encountered an error' ) else: display( OUTPUT_ERROR, 'task in process pool had an error %s' % str( task ) ) task.state = ERROR return task
from sys import path print(path) print("_" * 50) for j in path: print(j) path.append("/Users/mymac/PycharmProjects/beetroot/lesson17/stack_list.py") # C path можно работать как с обычным списком. # Влияет на поиск, так как можно добавить path других модулей. print("_" * 50) for j in path: print(j) print("_" * 50) path.remove("/Users/mymac/PycharmProjects/beetroot") for j in path: print(j)
import os from os.path import abspath, dirname from sys import path import site # remember original sys.path. prev_sys_path = list(path) site.addsitedir('/usr/local/virtualenvs/handsup/lib/python2.6/site-packages/') # reorder sys.path so new directories at the front. new_sys_path = [] for item in list(path): if item not in prev_sys_path: new_sys_path.append(item) path.remove(item) path[:0] = new_sys_path SITE_ROOT = dirname(dirname(abspath(__file__))) path.append(SITE_ROOT) # We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks # if running multiple sites in the same mod_wsgi process. To fix this, use # mod_wsgi daemon mode with each site in its own daemon process, or use # os.environ["DJANGO_SETTINGS_MODULE"] = "jajaja.settings" os.environ.setdefault("DJANGO_SETTINGS_MODULE", "handsup.settings.hippolito") os.environ.setdefault("SECRET_KEY", "not very secret at all..") # This application object is used by any WSGI server configured to use this # file. This includes Django's development server, if the WSGI_APPLICATION
def keyCancel(self): self.LivestreamerStop() if '/usr/lib/enigma2/python/Plugins/Extensions/GreekStreamTV' in path: path.remove('/usr/lib/enigma2/python/Plugins/Extensions/GreekStreamTV') self.close()
from os.path import abspath, expanduser, exists, join from StringIO import StringIO from sys import path # load the git submodule extra = abspath('PythonTidy') if not exists(join(extra, '.git')): call(['git', 'submodule', 'init']) call(['git', 'submodule', 'update']) # tweak path to allow importing PythonTidy from the git submodule path.insert(0, extra) import PythonTidy import PythonTidyWrapper path.remove(extra) def setup(): xml = expanduser('~/.pythontidy.xml') if exists(xml): config = PythonTidyWrapper.Config(file=xml) config.to_pythontidy_namespace() class python_tidy(TextCommand): def run(self, edit): setup() view = self.view region = Region(0L, view.size())
import win32file def get_free_disk_space(path): spc, bps, fc, tc = win32file.GetDiskFreeSpace(os_path.splitdrive(os_path.abspath(path))[0]) return spc * bps * fc // 1048576 except ImportError: def get_free_disk_space(path): return None ############################################################################### try: original_sys_path = sys_path[:] # if a self-test of some module from .shared is running, if "__main__" in sys_modules: # current directory contains conflicting resource.py main_module_dir = os.path.dirname(sys.modules["__main__"].__file__) or getcwd() if os_path.isfile(os_path.join(main_module_dir, "resource.py")): sys_path.remove(main_module_dir) try: import resource finally: sys_path = original_sys_path try: from resource import getrusage, RUSAGE_SELF finally: del sys_modules["resource"] # remove the reference to standard resource.py def get_working_set_size(): rusage = getrusage(RUSAGE_SELF) return rusage.ru_maxrss // 1024 def get_cpu_times(): rusage = getrusage(RUSAGE_SELF) return rusage.ru_utime, rusage.ru_stime except ImportError:
return spc * bps * fc // 1048576 except ImportError: def get_free_disk_space(path): return None ############################################################################### try: original_sys_path = sys_path[:] # if a self-test of some module from .shared is running, if "__main__" in sys_modules: # current directory contains conflicting resource.py main_module_dir = os.path.dirname( sys.modules["__main__"].__file__) or getcwd() if os_path.isfile(os_path.join(main_module_dir, "resource.py")): sys_path.remove(main_module_dir) try: import resource finally: sys_path = original_sys_path try: from resource import getrusage, RUSAGE_SELF finally: del sys_modules[ "resource"] # remove the reference to standard resource.py def get_working_set_size(): rusage = getrusage(RUSAGE_SELF) if rusage.ru_maxrss != 0: return rusage.ru_maxrss // 1024 elif system() == "Linux": # linux doesn't provide memory statistics
def load_proto_msgs(proto_path, ret_source_info=False): # List imports that we need to specify to protoc for the necessary *_pb2.py to be generated proto_dir = Path(proto_path).parent arg_proto_path = proto_dir arg_proto_files = [] to_import = [str(proto_path)] while to_import: next_import = to_import.pop() while not exists(arg_proto_path / next_import) and \ str(arg_proto_path.parent).startswith(str(BASE_PATH)): arg_proto_path = arg_proto_path.parent next_import = str(arg_proto_path / next_import) if next_import not in arg_proto_files: arg_proto_files.insert(0, next_import) with open(next_import) as fd: for prior_import in reversed( findall('import(?:\s*weak|public)?\s*"(.+?)"\s*;', fd.read())): to_import.append(prior_import) # Execute protoc and import the actual module from a tmp with TemporaryDirectory() as arg_python_out: args = [ 'protoc', '--proto_path=%s' % arg_proto_path, '--python_out=' + arg_python_out, *arg_proto_files ] if ret_source_info: args += [ '-o%s' % (Path(arg_python_out) / 'desc_info'), '--include_source_info', '--include_imports' ] cmd = run(args, stderr=PIPE, encoding='utf8') if cmd.returncode: raise ValueError(cmd.stderr) if ret_source_info: with open(Path(arg_python_out) / 'desc_info', 'rb') as fd: yield FileDescriptorSet.FromString(fd.read()), arg_proto_path return # Do actual import module_name = str(proto_dir).replace(str(arg_proto_path), '').strip('/\\').replace( '/', '.') if module_name: module_name += '.' module_name += Path(proto_path).stem.replace('-', '_') + '_pb2' PATH.append(arg_python_out) module = import_module(module_name) PATH.remove(arg_python_out) # Recursively iterate over class members to list Protobuf messages yield from iterate_proto_msg(module, '')
def _createProc(self,pid,config): proc = None procpath = None cwd = getcwd() load = True try: if 'resources' in config['general'] and 'modulepath' in config['general']: self.display( OUTPUT_LOGIC, 'setting up python modules for process %d from: %s::%s' % ( pid, config['general']['resources'], config['general']['modulepath'] ) ) #self.display('setting up process modules') cwd = getcwd() chdir( self._modulepath ) self.display( OUTPUT_DEBUG, 'set current working directory to %s' % getcwd() ) rmtree( str(pid), ignore_errors=True ) mkdir( str(pid) ) chdir( str(pid) ) self.display( OUTPUT_DEBUG, 'set current working directory to %s' % getcwd() ) temp = config['general']['resources'].split(':') srcHost = None srcPath = None fileName = None if len( temp ) == 1: srcPath = dirname(temp[0]) fileName = split(temp[0])[1] elif len( temp ) == 2: srcHost = temp[0] srcPath = dirname(temp[1]) fileName = split(temp[1])[1] if self._data_access.collect( getcwd(), fileName, srcHost, srcPath, fileName ): fname = split( config['general']['resources'] )[1] self.display( OUTPUT_DEBUG, 'trying to decompress %s' % fname ) #self.display( OUTPUT_DEBUG, 'files in process directory' ) #system( 'ls -al' ) if 0 == system( 'tar zxf %s' % fname ): #self.display( OUTPUT_DEBUG, 'files in process directory' ) #system( 'ls -al' ) config['general']['localresources'] = '%s/%s' % ( getcwd(), split( config['general']['resources'] )[1] ) files = listdir( config['general']['modulepath'] ) if path.count( getcwd() ) == 0: procpath = getcwd() + '/' + config['general']['modulepath'] path.insert( 0, procpath ) self.display( OUTPUT_DEBUG, 'updated module path to include %s' % procpath ) #for f in files: # if f.endswith( '.py' ): # move( config['general']['modulepath'] + '/' + f, './' ) # self.display( OUTPUT_DEBUG, 'moved %s into process cache' % f ) #self.display( OUTPUT_DEBUG, 'files in process directory' ) #system( 'ls -al' ) # reload the module so we have the latest copy for f in files: if f.endswith( '.py' ): #print path #print getcwd() #print f.split('.')[0] module = __import__( f.split('.')[0] ) reload( module ) self.display( OUTPUT_DEBUG, 'loaded module %s' % f.split('.')[0] ) #rmtree( dirname(config['general']['modulepath']), ignore_errors = True ) #self.display( OUTPUT_DEBUG, 'files in process directory' ) #system( 'ls -al' ) else: self.display( OUTPUT_ERROR, 'failed to extract resources' ) chdir( self._modulepath ) rmtree( str(pid), ignore_errors = True ) load = False else: self.display( OUTPUT_ERROR, 'failed to setup resources' ) chdir( self._modulepath ) rmtree( str(pid), ignore_errors = True ) load = False if load and 'modulename' in config['general']: self.display( OUTPUT_DEBUG, 'creating process %d as: %s' % ( pid, config['general']['modulename'] ) ) module = __import__( config['general']['modulename'].lower() ) reload(module) context = {'config':config} proc = eval( 'module.%s( context, pid )' % config['general']['modulename'] ) else: self.display( OUTPUT_ERROR, 'failed to start process' ) chdir( self._modulepath ) rmtree( str(pid), ignore_errors = True ) except: displayExcept() rmtree( str(pid), ignore_errors=True ) chdir( cwd ) proc = None self.display( OUTPUT_ERROR, 'failed to create process' ) if not load and not procpath == None: if path.count( procpath ) > 0: display( OUTPUT_DEBUG, 'removing path from process' ) path.remove( procpath ) return proc
def __on_plugin_directories_button_click(self, button): """Present a dialog to the user for selecting extra plugin directories and process the request.""" dia = Dialog('Plugin Directories', None, DIALOG_MODAL, (STOCK_OK, RESPONSE_OK, STOCK_CANCEL, RESPONSE_CANCEL ) ) dia.resize(500, 300) dia.vbox.set_spacing(8) # Setup the tree view of plugin directories. model = ListStore(str) # each row contains a single string tv = TreeView(model) cell = CellRendererText() column = TreeViewColumn('Directory', cell, text = 0) tv.append_column(column) dia.vbox.pack_start(tv) # Populate the tree view. plugin_directories = \ get_plugins_directories_from_config(self.config, self.config_path) for plugin_directory in plugin_directories: row = (plugin_directory,) model.append(row) modify_box = HBox(spacing = 8) # Setup the remove directory button. remove_button = Button('Remove') remove_button.set_sensitive(False) # no directory selected initially remove_button.connect('clicked', self.__on_remove, tv) modify_box.pack_end(remove_button, expand = False) tv.connect('cursor-changed', self.__on_select, remove_button) # Setup the add directory button. add_button = Button('Add') add_button.connect('clicked', self.__on_add, tv) modify_box.pack_end(add_button, expand = False) dia.vbox.pack_start(modify_box, expand = False) # Setup the "already included directories" label. included_label = Label('Plugins in the PYTHONPATH are already ' + 'available to BoKeep.') # Use a horizontal box to left-justify the label. For some reason, # the label's set_justification property doesn't work for me. label_box = HBox() label_box.pack_start(included_label, expand = False) dia.vbox.pack_start(label_box, expand = False) dia.show_all() dia_result = dia.run() if dia_result == RESPONSE_OK: # Remove the old plugin directories from the program's path. plugin_directories = \ get_plugins_directories_from_config(self.config, self.config_path) for plugin_directory in plugin_directories: path.remove(plugin_directory) # Get the new plugin directories from the dialog. plugin_directories = [] for row in model: plugin_directory = row[0] plugin_directories.append(plugin_directory) # Update the BoKeep PYTHONPATH so that new plugins can be loaded and # populate the list of possible new plugins. for plugin_directory in plugin_directories: path.append(plugin_directory) self.__populate_possible_plugins() # Save the new plugin directories in the configuration file. set_plugin_directories_in_config(self.config, self.config_path, plugin_directories) dia.destroy()
# f = open('drive:/path/to/output.txt', 'w') # Provide detailed analysis of the words in the requested data from sys import path path.append('..') from tls.fns.zip import zipfaiData path.remove('..') srt = zipfaiData()[0] lst = dict(sorted(srt.items(), key=lambda item: item[1]) ) # Sort the dict based on the occurences of the word lst = list(lst.items()) # Convert the sorted dict to sorted tuples first = str(lst[-1]).split(', ')[1].split( ')' )[0] # get the number of times the most frequent word appears (used to calculate percentage below) for w in sorted(srt, key=srt.get, reverse=True): print( str((int(srt[w]) * 100) / (int(first)))[:5] + '%', w, srt[w] ) # print percentage or ratio compared to most frequent word, the word, and number of occurences # append "file = f" to print output to file
from sys import path path.append('../../../') import manage path.remove('../../../')
from sys import path path.remove("/opt/ros/kinetic/lib/python2.7/dist-packages") from control import tello_center, tello_abs, tello_image_process, tello_judge_client, tello_imshow, \ tello_control from control.tello_main import main from control import tello_yolo if __name__ == '__main__': tello_center.register_service( tello_center.ConfigService( config={ # main config tello_center.ConfigService.CONFIG_DEBUG: True, # Tello backend config tello_abs.TelloBackendService.CONFIG_STOP: False, tello_abs.TelloBackendService.CONFIG_AUTO_WAIT_FOR_START_IMAGE_AND_STATE: True, # Yolo config tello_yolo.YoloService.CONFIG_LOOP_DETECTION: False, tello_yolo.YoloService.CONFIG_DETECT_ON_MAIN_THREAD: True, tello_yolo.YoloService.CONFIG_USE_YOLO: False, # FPS config
path = ospath.join(PLUGINS_PATH, file) if ospath.isdir(path) and not(file.startswith(".")) \ and ospath.exists(ospath.join(path, "__init__.py")): PLUGINS.append(file) #del used dependencies del ospath del glob1 #del py_plugins_files __all__ = tuple(PLUGINS) PLUGINS_GLOBALS = globals() #read all plugins syspath.insert(0, PARENT_DIR) from plugins import * syspath.remove(PARENT_DIR) del PARENT_DIR def get_plugin(plugin_name): if not plugin_name in PLUGINS_GLOBALS: return plugin = PLUGINS_GLOBALS[plugin_name] return plugin def get_plugin_name(plugin): if hasattr(plugin, "PLUGIN_NAME"): return plugin.PLUGIN_NAME
intents = discord.Intents.all() client = discord.Client(intents=intents) logging.basicConfig(level=logging.INFO) random.seed() command_prefix = '$' # Import commands commands = [] path.append(getcwd() + '/commands') for file in listdir('commands'): if file == '__pycache__': continue commands.append(__import__(file[:-3]).cmd) # [:-3] to get rid of .py path.remove(getcwd() + '/commands') @client.event async def on_ready(): print(f'We have logged in as {client.user}') channel = client.get_channel(874361456194375730) # Bot does not recognize old messages after restart, clear old get-roles message, and add a new one async for check_message in channel.history(limit=200): await check_message.delete() reactions = { '🥳': ['Notified', 'Gets pinged at the start of every stream!'], '🖥️': ['Invite to Clash', 'Gets pinged when people are putting together a CoC lobby!'], '❓': ['Notified QOTD', 'Gets pinged when the QOTD is posted every day!'] } embedVar = discord.Embed(title="React for Roles!", description="React to this message to get roles!", color=0x15fffe) for emoji, value in reactions.items(): embedVar.add_field(name=f'{value[0]} {emoji}', value=f'{value[1]}', inline=False)
from subprocess import call from os.path import abspath, expanduser, exists, join from StringIO import StringIO from sys import path # load the git submodule extra = abspath('PythonTidy') if not exists(join(extra, '.git')): call(['git', 'submodule', 'init']) call(['git', 'submodule', 'update']) # tweak path to allow importing PythonTidy from the git submodule path.insert(0, extra) import PythonTidy import PythonTidyWrapper path.remove(extra) def setup(): xml = expanduser('~/.pythontidy.xml') if exists(xml): config = PythonTidyWrapper.Config(file=xml) config.to_pythontidy_namespace() class python_tidy(TextCommand): def run(self, edit): setup() view = self.view region = Region(0L, view.size()) encoding = view.encoding()
def run(self, process, action_value, *args, **kwargs): """ Will process the information passed in action_value. """ python_path = format_value(process, "path", default_value=self.python_path) if not exists(python_path): raise ValueError("The directory [%s] not exist." % self.python_path) path_exist = python_path in path try: if not path_exist: path.append(python_path) # Check the module module = format_value(process, "module", default_value=None) if module is None: raise ValueError("The module was not set in %s that use the connection [%s]" % (process["tag"], process["connection_name"])) if not (exists(join(python_path, module + ".py")) or exists(join(python_path, module + ".pyc"))): raise ValueError("The module [%s] not exist in the path [%s]" % (module, python_path)) class_name = format_value(process, "class", default_value=None) method = format_value(process, "method", default_value="run") module_ref = __import__(module, fromlist=None if class_name is None else [class_name, ]) instance = (None, 1, "Was not implemented yet!") if class_name: class_ref = getattr(module_ref, class_name)() instance = getattr(class_ref, method)(process, action_value, *args, **kwargs) else: instance = getattr(module_ref, method)(process, action_value, *args, **kwargs) return instance except Exception, e: return (None, settings.SYSTEM_ERROR, e) finally: if not path_exist: path.remove(python_path)
def keyCancel(self): self.LivestreamerStop() if "/usr/lib/enigma2/python/Plugins/Extensions/GreekStreamTV" in path: path.remove("/usr/lib/enigma2/python/Plugins/Extensions/GreekStreamTV") self.close()
path = ospath.join(PLUGINS_PATH, file) if ospath.isdir(path) and not(file.startswith(".")) \ and ospath.exists(ospath.join(path, "__init__.py")): PLUGINS.append(file) #del used dependencies del ospath del glob1 #del py_plugins_files __all__ = tuple(PLUGINS) PLUGINS_GLOBALS = globals() #read all plugins syspath.insert(0, PARENT_DIR) from plugins import * syspath.remove(PARENT_DIR) del PARENT_DIR def get_plugin(plugin_name): if not plugin_name in PLUGINS_GLOBALS: return plugin = PLUGINS_GLOBALS[plugin_name] return plugin def get_plugin_name(plugin): if hasattr(plugin, "PLUGIN_NAME"): return plugin.PLUGIN_NAME def get_plugin_description(plugin): if hasattr(plugin, "PLUGIN_DESCRIPTION"):
from time import sleep from os import environ from sys import path from urllib import urlretrieve import tarfile # To prevent attempting to load c:\windows\system32\zlib.dll on windows for x in path : if x.lower() == 'c:\\windows\\system32' : path.remove(x) break sleep(5) try : fn = urlretrieve(environ['SMDS_URL'])[0] f = tarfile.open(fn, 'r:gz') for m in f.getmembers() : f.extract(m, environ['SMDS_LOC']) except : pass from smds.starter import start start(False)
import os from os.path import abspath, dirname from sys import path SITE_ROOT = dirname(dirname(abspath(__file__))) path.append(SITE_ROOT) try: WORKING_DIR = dirname(abspath(__file__))) path.append(WORKING_DIR) # Could fail if there exists 2 settings modules on PYTHONPATH... from settings.deployment_variables import DEPLOYMENT_STATUS path.remove(WORKING_DIR) except ImportError as error_msg: raise error_msg try: SETTINGS_PATH = "www_vandorjw_me.settings.%s" % DEPLOYMENT_STATUS os.environ.setdefault("DJANGO_SETTINGS_MODULE", SETTINGS_PATH) except: error_msg = "Could not set DJANGO_SETTINGS_MODULE, check PYTHONPATH" raise error_msg # This application object is used by any WSGI server configured to use this # file. This includes Django's development server, if the WSGI_APPLICATION # setting points here. from django.core.wsgi import get_wsgi_application application = get_wsgi_application() # Apply WSGI middleware here. # from helloworld.wsgi import HelloWorldApplication