Django app to explore directory.
Project description
Django File Explorer
A django app to explore the host machine directory.
It will provide following features:
- Allow user login
- Allow to set roles for user to delete and download directories.
- Allow user to upload single file.
Installation
Following command will help to install the package.
pip install django-file-explorer
Setup
- Add the app to setting.py file in INSTALLED_APPS section.
INSTALLED_APPS = [
...
'explorer.apps.ExplorerConfig',
]
- If logging is required then add the following information to settings.py file:
EXPLORER = {
'log_dir': MEDIA_ROOT / 'logs',
'log_file': MEDIA_ROOT / 'logs' / 'access.log'
}
log_dir: This is the path where multiple user log files will be created. Each file contain information about the single user.
log_file: Path to a file containing log information.
Following is the example of single log line.
[25/Feb/2023 12:44:43:PM] GET | 200 | <<username>> | <<action>> | <<volume>> | <<pageNumber>> | <<location>> | <<checkboxIdx>> |
- Migrate the changes
python manage.py migrate
I you are managing DB separate then make following tables in database:
explorer_action
Name | Position | Data type | Length | Relation | Not NULL? | Type |
---|---|---|---|---|---|---|
id | 1 | bigint | PK | true | None | |
name | 2 | character varying | 120 | true | None | |
creation_date | 3 | timestamp with time zone | true | None |
Add following actions to table:
- download
- delete
- upload
Note: All PK are auto incremental.
explorer_volume
Name | Position | Data type | Length | Relation | Not NULL? | Type |
---|---|---|---|---|---|---|
id | 1 | bigint | PK | true | None | |
name | 2 | character varying | 120 | true | None | |
path | 3 | character varying | 2048 | true | None | |
active | 4 | boolean | true | None | ||
creation_date | 5 | timestamp with time zone | true | None |
explorer_userrole
Name | Position | Data type | Length | Relation | Not NULL? | Type |
---|---|---|---|---|---|---|
id | 1 | bigint | PK | true | None | |
creation_date | 2 | timestamp with time zone | true | None | ||
user_id | 3 | integer | FK | true | None | |
volume_id | 4 | bigint | FK | true | None |
Foreign Key Constraints
Name | Columns | Referenced Table |
---|---|---|
user_id | (user_id) -> (id) | auth_user |
volume_id | (volume_id) -> (id) | explorer_volume |
explorer_userrole_actions
Name | Position | Data type | Length | Relation | Not NULL? | Type |
---|---|---|---|---|---|---|
id | 1 | bigint | PK | true | None | |
userrole_id | 2 | bigint | FK | true | None | |
action_id | 3 | bigint | FK | true | None |
Foreign Key Constraints
Name | Columns | Referenced Table |
---|---|---|
userrole_id | (userrole_id) -> (id) | explorer_userrole |
action_id | (action_id) -> (id) | explorer_action |
- Add URL to urls.py file.
from django.urls import include
urlpatterns = [
...
path('explorer/', include('explorer.urls'), name='explorer')
]
Add volumes to database by specifying its name and path. After that define the user roles for specific volume in user roles table.
Run
Go to explorer url SERVER:PORT/explorer and explore the volumes.
Author
Tahir Rafique
Releases
Date | Version | Summary |
---|---|---|
16-Jun-23 | v1.5.0 | Separating vscode icons from this app. |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django-file-explorer-1.5.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c018f422490102b3b2eff33f7ff0b11fa40d6d0a60e30afd9a8fc5de9dbc8614 |
|
MD5 | 4e40ef9e30a2529c98e097b303f4f93b |
|
BLAKE2b-256 | 0bbf7f42661f1b5d6103b52f2af846f5464408cce4303c1d73411764ccb7ac0f |
Hashes for django_file_explorer-1.5.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d1ac4e54cbe63f273406102f22c4b615dcbfbca0a80b96473654473ed014bb6 |
|
MD5 | 3ced447fb27f5f7dbdc414b1788769fb |
|
BLAKE2b-256 | 2d8104e67d504b7eaaa0a7b0a9ffad5855da0aa4f836b6eade277f950fb39b8b |