mirror of
https://github.com/wahyd4/links.git
synced 2026-08-09 05:06:16 +10:00
136 lines
3.3 KiB
Markdown
136 lines
3.3 KiB
Markdown
# URL Manager
|
|
|
|
URL Manager is a Django-based web application for managing and tracking short URLs.
|
|
|
|
## Features
|
|
|
|
- Create, edit, and delete short URL links
|
|
- Track click statistics for each link
|
|
- Search functionality for quick access to links
|
|
- Internationalization support (English and Simplified Chinese)
|
|
- Responsive design using Tailwind CSS
|
|
|
|
## Prerequisites
|
|
|
|
- Docker and Docker Compose
|
|
|
|
## Installation and Setup with Docker
|
|
|
|
1. Clone the repository:
|
|
```
|
|
git clone https://github.com/yourusername/url-manager.git
|
|
cd url-manager
|
|
```
|
|
|
|
2. Build the Docker image:
|
|
```
|
|
docker build -t url-manager .
|
|
```
|
|
|
|
3. Create a Docker volume for persistent database storage:
|
|
```
|
|
docker volume create url-manager-data
|
|
```
|
|
|
|
4. Run the Docker container:
|
|
```
|
|
docker run -d --name url-manager-container -p 8000:8000 -v url-manager-data:/app/data url-manager
|
|
```
|
|
|
|
5. Initialize the database and create a superuser:
|
|
```
|
|
docker exec -it url-manager-container python manage.py migrate
|
|
docker exec -it url-manager-container python manage.py createsuperuser
|
|
```
|
|
|
|
6. Open your web browser and navigate to `http://localhost:8000` to access the application.
|
|
|
|
## Usage
|
|
|
|
- To create a new short URL, click on the "Create New Link" button on the home page.
|
|
- To edit or delete a link, use the corresponding buttons in the link list.
|
|
- To view detailed statistics for a link, click on the "Details" button.
|
|
- Use the search bar in the navigation to quickly find links by alias or original URL.
|
|
|
|
## Admin Interface
|
|
|
|
To access the admin interface:
|
|
|
|
1. Go to `http://localhost:8000/admin`
|
|
2. Log in with the superuser account you created earlier
|
|
|
|
## Changing the Language
|
|
|
|
To switch between English and Simplified Chinese, use the language selector in the navigation bar.
|
|
|
|
## Persistent Data
|
|
|
|
The SQLite database is stored in the Docker volume `url-manager-data`. This ensures that your data persists even if the container is stopped or removed. To backup your data, you can copy the contents of this volume.
|
|
|
|
## Contributing
|
|
|
|
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
|
|
## License
|
|
|
|
This project is licensed under the MIT License.
|
|
|
|
## Local Development
|
|
|
|
To run the URL Manager locally:
|
|
|
|
1. Clone the repository:
|
|
```
|
|
git clone https://github.com/yourusername/url-manager.git
|
|
cd url-manager
|
|
```
|
|
|
|
2. Create and activate a virtual environment:
|
|
```
|
|
python -m venv venv
|
|
source venv/bin/activate # On Windows, use `venv\Scripts\activate`
|
|
```
|
|
|
|
3. Install dependencies:
|
|
```
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
4. Apply database migrations:
|
|
```
|
|
python manage.py migrate
|
|
```
|
|
|
|
5. Create a superuser:
|
|
```
|
|
python manage.py createsuperuser
|
|
```
|
|
|
|
6. Compile translation messages:
|
|
```
|
|
python manage.py compilemessages
|
|
```
|
|
|
|
7. In one terminal, start the Tailwind CSS build process:
|
|
```
|
|
python manage.py tailwind start
|
|
```
|
|
|
|
8. In another terminal, run the Django development server:
|
|
```
|
|
python manage.py runserver
|
|
```
|
|
|
|
9. Open your browser and go to `http://127.0.0.1:8000`
|
|
|
|
Remember to keep both the Tailwind CSS build process and the Django development server running while you're developing.
|
|
|
|
## Tools
|
|
|
|
The URL Manager includes a Tools page with the following features:
|
|
|
|
- Export all aliases as a JSON file
|
|
- Import aliases from a JSON file
|
|
|
|
To access the Tools page, click on the "Tools" link in the navigation bar.
|