-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started
The FileSublime was built using Django version 2.1.1. It is not guaranteed to work with newer or older versions of Django. Use unsupported versions at your own risk. The easiest way to download version 2.1.1 of Django on a Linux machine is to use the command
pip install django==2.1.1
Django uses the psycopg2 library, which can also be installed using the following command
pip install psycopg2-binary
Finally, our project uses server-side DataTables processing. You need to install the library for this using the following command
pip install django-datatables-view
Setting up PostgreSQL varies by OS and distribution. You can visit PostgreSQL's official website or other online resources on how to setup PostgreSQL for your OS. For example, on an Ubuntu Linux machine, you can install PostgreSQL using the command sudo apt-get install postgresql postgresql-contrib
Once you setup PostgreSQL, you must create a database to be used by FileSublime by your method of choice. It is also be a good idea to create a user for FileSublime. You must give this user privileges to change the database you created. While you can use the default user created with PostgreSQL, it is not recommended. Remember what you named your database as well as the user’s username and password.
Now clone the FileSublime to machine. Open src/app/FileBrowser/FileBrowser/settings.py. Find the section marked “Database.” There you should change the default settings to match how you set-up PostgreSQL. This includes a database name, username and password. It may be a good idea to create a user for FileSublime.
Now we must populate the database with our Json files. Place all your Json files in src/app/FileBrowser/browser/data-export. Then change your current working directory to src/app/FileBrowser. On a Linux machine, run the following commands:
python manage.py makemigrations browser
python manage.py migrate browser
python manage.py importJson browser data-export
Now your database is set-up and ready to be used.
In the event of a new file dump, you need to update the database. You must place your new Json files in the data-export folder and static/files folder. Then run
python manage.py importJson browser data-export
After you import the Json files’ information into the database, you should move them to src/app/FileBrowser/browser/static/files. The FileSublime will look here for files when there is a download request.
In order to use FileSublime, you need to add users. The systems a user is able to view is determined by their username. A user's username should be the tenant a user is associated with. For example, if the user's username is "hpe" they will be able to view all systems.
To add a user, use the following command
python manage.py add_user username password admin
where username and password are replaced with the user's username and password.
Once everything is setup and you are ready to run the server, navigate to src/app/FileBrowser and run the command
python manage.py runserver
Django by default will use the socket 127.0.0.1:8000. You can specify which socket to use by appending the argument “address:port” to this command. For example, you can use python manage.py runserver 159.23.255.192:8002
to run the server at IP address 159.23.255.192 with port 8002. If you use a different IP address, make sure to add it in src/FileBrowser/FileBrowser/settings.py under “ALLOWED_HOSTS.”