zimpy: Self hosted wikipedia
zimpy: Personal Wikipedia Hosting
GitHub Repository
zimpy enables you to host Wikipedia content locally through a simplified Flask webserver. It is designed to be used with ZIM files, which are offline Wikipedia archives. This project is built for my specific use case and is not designed for broad compatibility. If your ZIM file structure diverges from the one used here, or if you are utilizing a different Python version, the project may not function as intended. For a more versatile ZIM file reader, please refer to ZIMply.
Table of Contents
Features
- ZIM File Reading: Parses and reads ZIM files, displaying numerous articles and images.
- Local Hosting: Provides offline access to Wikipedia content through a Flask webserver.
- Search Capability: Implements an SQLite database to facilitate quick searches through Wikipedia articles.
Getting Started
Prerequisites
- Python 3.8 or later
Installation
- Clone the repo:
git clone https://github.com/squarra/zimpy
- Navigate to the project directory and install the dependencies:
cd zimpy
pip install -r requirements.txt
Usage
- Ensure you have a ZIM file for the Wikipedia content you intend to display.
- Run the server script:
python main.py
- The database is then populated with the contents of the ZIM file. This may take a few minutes.
- Access the hosted content by navigating to
127.0.0.1:5000
in your web browser.
Custom Templates
You can modify the default template in templates/base.html
or provide a new template as an argument to ZIMServer
. Ensure that custom templates are placed in the templates
directory.
from zimpy import ZIMServer
server = ZIMServer("wiki.zim", "your_custom_template.html")
server.app.run()
License
Distributed under the GNU General Public License v3.0. See LICENSE
for more information.
Acknowledgements
- pyzim-tools: Portions of the codebase are modified from this repository. The original code is licensed under GPLv3.0.
- ZIMply: Inspired the creation of this project and serves as a reference for a more broadly compatible ZIM file reader.