Skip to content

Repository files navigation

QueryPix

This is a restful API which facilitates downloading, resizing, and securely storing images fetched from Google based on user-specified queries, leveraging Django for robust backend operations and Docker for seamless deployment and scalability.

Installation without Docker

  • First of all clone the project:
username@hostname:~$ git clone https://github.com/HaamedKhosravii/QueryPix.git
  • Enter the project directory:
username@hostname:~$ cd QueryPix
  • Then, we need a virtual environment you can create like this:
username@hostname:~/QueryPix$ virtualenv venv
  • Activate it with the command below:
username@hostname:~/QueryPix$ source venv/bin/activate
  • After that, you must install all the packages in requirements.txt file in project directory:
username@hostname:~/QueryPix$ pip install -r requirements.txt
  • Now, create your database:

    • Open your postgresql shell:

      username@hostname:~/QueryPix$ sudo -u postgres psql
    • Create Database

      CREATE DATABASE <database_name>;
    • Create User

      CREATE USER <database_user> WITH PASSWORD '<database_password>';
    • Grant all privileges to of the created database to the created user:

      GRANT ALL PRIVILEGES ON DATABASE <database_name> TO <database_user>;
  • Create a .env file, then add your created config:

SECRET_KEY = 'Your secret key generated by https://djecrety.ir'
DEBUG = 'Project debug status'
DB_NAME = '<database_name>'
DB_USER = '<database_user>'
DB_PASS = '<database_password>'
DB_HOST = '<database_host>'
DB_PORT = <database_port>
  • Enter the following command for migrations:
username@hostname:~/QueryPix$ python3 manage.py migrate
  • Run the project via this command:
username@hostname:~/QueryPix$ python3 manage.py runserver
  • Run the command below for tests:
username@hostname:~/QueryPix$ pytest -v downloader/tests.py 

Installation with Docker

  • First of all clone the project:
username@hostname:~$ git clone https://github.com/HaamedKhosravii/QueryPix.git
  • Enter the project directory:
username@hostname:~$ cd QueryPix
  • Build and run the containers using docker-compose:
username@hostname:~/QueryPix$ sudo docker-compose up --build

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages