This project is a web application built with Django and Django REST Framework. It provides a simple user interface that allows users to generate CSV files based on their input. Users can specify column names, types, and the number of records they want in the CSV file. Once the form is submitted, a CSV file is dynamically generated and made available for download.
- User Interface: A web form for inputting column names, types, and the number of records.
- CSV Generation: Dynamically generates a CSV file based on user input.
- File Download: Provides a direct link for users to download the generated CSV file.
- Django: A high-level Python web framework that simplifies the development of web applications.
- Django REST Framework: A powerful toolkit for building Web APIs.
- Pandas: A data analysis library used for creating and manipulating data frames.
- HTML/JavaScript: For creating the user interface and handling form submissions.
Ensure you have the following installed:
- Python (>= 3.6)
- pip (Python package installer)
-
Clone the Repository:
git clone <repository-url> cd <repository-directory>
-
Create and Activate a Virtual Environment:
python -m venv venv source venv/bin/activate # On Windows use: venv\Scripts\activate
-
Install Dependencies:
pip install -r requirements.txt
-
Create a Requirements File (Optional):
pip freeze > requirements.txt
-
Apply Database Migrations:
python manage.py migrate
-
Run the Development Server:
python manage.py runserver
-
csvgenerator/
: The Django project directory.settings.py
: Configuration settings for the Django project.urls.py
: URL declarations for the project.
-
generator/
: The Django application directory.views.py
: Contains views for rendering the form and handling CSV generation.serializers.py
: Contains serializers for validating and processing incoming data.urls.py
: URL declarations for the app.templates/generator/index.html
: HTML template for the user interface.
-
POST /api/generate/
: Generates a CSV file based on the provided columns and number of records.Request Body:
{ "columns": [ {"name": "column_name", "dtype": "int"}, {"name": "another_column", "dtype": "float"} ], "num_records": 100 }
- Project Structure: Lists the directory structure and the purpose of key files.
- API Endpoints: Details the endpoint for generating CSV files, including request and response formats.
- HTML Form Details: Describes how the form works, including how to add columns and generate the CSV file.
- Troubleshooting: Offers tips for resolving common issues.
- License: Information about the project's license.
- Contributing: Instructions for contributing to the project.