0

I want to show structure of python project like this.

can I uses some commend like python manage.py [something]...?

ROOT
├── lib
│   ├── django
│   ├── pytz
│   ├── wanttousing_lib
│   └── ...
├── mysite
│   ├── __init__.py
│   ├── settings.py
│   ├── controllers.py
│   ├── models.py
│   ├── views.py
│   ├── templates
│   │   └── like
│   │        ├── index.html
│   │        └── _likehelpers.html
│   └── ....
├── test
│   ├── like
│   │   ├── models_tests.py
│   │   └── controllers_tests.py
│   └── ....
├── static
│   ├── css
│   └── js
├── app.yaml
├── manage.py
├── appengine_config.py
└── requirements.txt
akinuri
  • 10,690
  • 10
  • 65
  • 102
Maibi
  • 45
  • 1
  • 7

3 Answers3

0

There is a command line tool named tree in Linux & Mac OS. You can install it with package manager.

brew install tree  # for mac os
yum install tree # for centos

cd path/to/ROOT
tree . -I "regex_of_ignored_files_and_dirs" -o outputfilename

Or you can modify the manager.py to call this command in it.

stamaimer
  • 6,227
  • 5
  • 34
  • 55
0

In the Windows command prompt

cd path/to/ROOT
tree /f

or if you want to export this tree to a file, use this command

tree /f > tree.txt

then open tree.txt

In Linux/MacOS terminal

First, you should install package name tree

  • In MacOS: brew install tree
  • In RHEL/CentOS/Fedora: yum install tree
  • In Debian/Mint/Ubuntu: sudo apt-get install tree

Then run this command:

tree /path/to/ROOT
Chuong Huynh
  • 84
  • 1
  • 6
0

exa can do this. You can find installation instructions here. However, on macOS, it's just:

brew install exa

The command looks like this:

exa -T my_stuff

my_stuff
├── file1.txt
├── file2.csv
├── file3.py
└── more_stuff
   └── file3.pyc

or

cd /to/your/folder
exa -T

.
├── file1.txt
├── file2.csv
├── file3.py
└── more_stuff
   └── file3.pyc
Daniel Corin
  • 1,987
  • 2
  • 15
  • 27
  • I believe the author wants to show the structure of a Python project but is not confining solutions to use only Python – Daniel Corin Aug 09 '17 at 02:27