This project provides a simple interface for searching and displaying images using the Pexels API. It leverages Flask for the web interface, allowing users to input search queries and view results directly on the webpage.
Before you begin, it's recommended to create a new virtual environment for this project to manage dependencies effectively.
-
For Windows: Open Command Prompt and run:
python -m venv venv
-
For macOS/Linux: Open Terminal and run:
python3 -m venv venv
This creates a new virtual environment named
venv. You can choose a different name if preferred.
-
On Windows:
.\venv\Scripts\activate
-
On macOS/Linux:
source venv/bin/activate
Replace your-repository-url with the URL of your project repository:
git clone https://your-repository-url.git
cd your-project-directoryEnsure your-project-directory is the folder containing your project.
Within the activated virtual environment, install dependencies via:
pip install -r requirements.txtThis project requires Python 3.x and the following libraries:
Flask: For creating the web application.python-dotenv: To manage environment variables.requests: For making HTTP requests to the Pexels API.pexels-api: An optional wrapper for the Pexels API, not used directly in this project due to customization needs.
Start the application with:
python app.pyThis command launches a Flask server, making the application accessible at http://127.0.0.1:5000/ by default. Users can search for images via the web interface, with search results dynamically rendered on the same page.
app.py: Flask application setup, including routes for handling search requests.templates/: Folder containing HTML templates for the search page and results display.api/connector.py: Module for interfacing with the Pexels API, customized for specific project needs.requirements.txt: Lists the Python packages necessary for the project.
The web interface allows users to input search terms and select filters for image orientation, color, and size. The search results, including image previews and photographer credits, are displayed directly below the search form.
Contributions to this project are welcome! Please fork the repository and submit a pull request with your proposed changes. For major changes, please open an issue first to discuss what you would like to change.