This is a cloud storage server built with Django REST Framework. It provides an API for managing users and files in the cloud.
- User registration & authorization
- Token-based authentication
- User management
- File management
-
Clone the repository:
git clone https://github.com/DexRam/CS-01-Server-DjangoRESTFramework-cloudStorage cd CS-01-Server-DjangoRESTFramework-cloudStorage
-
Create and activate a virtual environment:
python -m venv .venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the dependencies:
pip install -r requirements.txt
-
Set up the settings:
a. Go to cloudStorage - customization.py b. Configure BASE_DIR if needed c. Configure SECRET_KEY, generate new one by:
bash python -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"
d. Configure DATABASES if needed i. Configure CORS_ALLOWED_ORIGINS f. Configure ALLOWED_HOSTS d. Configure FILES_DIRECTORY if needed -
Set up the database:
python manage.py makemigrations python manage.py migrate
-
Create a superuser:
python manage.py createsuperuser
-
Run the development server:
python manage.py runserver
- URL:
/api/users/register/
- Method:
POST
- Permission:
AllowAny
- URL:
/api/users/login/
- Method:
POST
- Permission:
AllowAny
- URL:
/api/users/me/
- Method:
GET
- Permission:
IsAuthenticated
- URL:
/api/files/upload-file/
- Method:
POST
- Permission:
IsAuthenticated
- URL:
/api/files/{id}/update-file/
- Method:
PATCH
- Permission:
IsAuthenticated
- URL:
/api/files/{id}/download-file/
- Method:
GET
- Permission:
IsAuthenticated
- URL:
/api/files/{id}/share-file/
- Method:
POST
- Permission:
IsAuthenticated
- URL:
/api/files/{id}/delete-file/
- Method:
DELETE
- Permission:
IsAuthenticated
- URL:
/api/files/user-files/
- Method:
POST
- Permission:
IsAuthenticated
- URL:
/api/files/download-shared/{share_link}/
- Method:
GET
- Permission:
AllowAny
- URL:
/api/users/
or/api/files/
- Method:
GET
- Permission:
IsAuthenticated, IsAdminUser
- URL:
/api/users/
or/api/files/
- Method:
POST
- Permission:
IsAuthenticated, IsAdminUser
- URL:
/api/users/{id}/
or/api/files/{id}/
- Method:
GET
- Permission:
IsAuthenticated, IsAdminUser
- URL:
/api/users/{id}/
or/api/files/{id}/
- Method:
PUT
- Permission:
IsAuthenticated, IsAdminUser
- URL:
/api/users/{id}/
or/api/files/{id}/
- Method:
PATCH
- Permission:
IsAuthenticated, IsAdminUser
- URL:
/api/users/{id}/
or/api/files/{id}/
- Method:
DELETE
- Permission:
IsAuthenticated, IsAdminUser
These endpoints cover user registration, authentication, file upload, download, sharing, and management functionalities.
- Fork the repository
- Create a new branch (git checkout -b feature-branch)
- Commit your changes (git commit -am 'Add new feature')
- Push to the branch (git push origin feature-branch)
- Create a new Pull Request
This project is licensed under the MIT License. Feel free to customize it according to your project's specific details and requirements.