Posts: 4,551
Threads: 1,459
Joined: Sep 2016
i wanted to import a module from a specific file that may be in a subdirectory maybe even many levels deep. the current directory will always be at some level above the module. the path will never have '/../' in it and will always be relative to the current directory. there will never be any symlinks involved. suggestions?
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Posts: 4,551
Threads: 1,459
Joined: Sep 2016
Jun-03-2017, 04:02 AM
(This post was last modified: Jun-03-2017, 04:16 AM by Skaperen.)
the path is in a string, not hard coded in the source. the depth is unknown until the string with the path is known.
i found this ... what do you think?
https://stackoverflow.com/questions/6763...-full-path
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Posts: 4,551
Threads: 1,459
Joined: Sep 2016
my goal is to expand on the apparent limitation that mod-wsgi only operates on the file named in the apache directive. you can't just enable a directory. so my idea is that my code will take PATH_INFO and use that to select a module, and invoke that in the same way, passing on the WSGI environment (with PATH_INFO truncated as needed). that way i can make a site with a number of different scripts. my code will restrict the path as needed for security (only stuff under the script's own directory can be invoked).
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Posts: 4,551
Threads: 1,459
Joined: Sep 2016
Jun-13-2017, 04:30 AM
(This post was last modified: Jun-13-2017, 04:30 AM by Skaperen.)
it turns out you
can enable a directory for mod-wsgi execution. you just have to append the directory names with a '/' in the apache config directive.
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.