Best practice for Django project working directory structure [closed]

There’re two kind of Django “projects” that I have in my ~/projects/ directory, both have a bit different structure.: Stand-alone websites Pluggable applications Stand-alone website Mostly private projects, but doesn’t have to be. It usually looks like this: ~/projects/project_name/ docs/ # documentation scripts/ manage.py # installed to PATH via setup.py project_name/ # project dir (the … Read more

mkdir -p functionality in Python [duplicate]

For Python ≥ 3.5, use pathlib.Path.mkdir: import pathlib pathlib.Path(“/tmp/path/to/desired/directory”).mkdir(parents=True, exist_ok=True) The exist_ok parameter was added in Python 3.5. For Python ≥ 3.2, os.makedirs has an optional third argument exist_ok that, when True, enables the mkdir -p functionality—unless mode is provided and the existing directory has different permissions than the intended ones; in that case, OSError … Read more

How to [recursively] Zip a directory in PHP? [duplicate]

Here is a simple function that can compress any file or directory recursively, only needs the zip extension to be loaded. function Zip($source, $destination) { if (!extension_loaded(‘zip’) || !file_exists($source)) { return false; } $zip = new ZipArchive(); if (!$zip->open($destination, ZIPARCHIVE::CREATE)) { return false; } $source = str_replace(‘\\’, “https://stackoverflow.com/”, realpath($source)); if (is_dir($source) === true) { $files … Read more

What is the best project structure for a Python application? [closed]

Doesn’t too much matter. Whatever makes you happy will work. There aren’t a lot of silly rules because Python projects can be simple. /scripts or /bin for that kind of command-line interface stuff /tests for your tests /lib for your C-language libraries /doc for most documentation /apidoc for the Epydoc-generated API docs. And the top-level … Read more