8000
Skip to content

marium19/pasteme

 
 

Repository files navigation

PasteMe - RESTful Pastebin Service


Check out the article describing the development and deplo B72B yment steps behind this service on Hashnode.

A RESTful pastebin service made for @hashnode purposes powered by the @PlanetScale MySQL DBaaS. There is a Bootstrap template shining behind the DRF components to show the information but the focuse is on the RESTful service where you can create snippets from almost all platforms!

Paste to PasteMe

Use the pasteme-cli package and start pasting. Once you paste your content, you'll be able to share it with others.

$ pip install pasteme-cli
...
$ pasteme --help

Service Installation

1. To setup the webservice locally, clone the repository first.

$ git clone https://github.com/collove/pasteme.git && cd ./pasteme

2. Create a new venv and install the dependencies.

$ virtualenv venv && source venv/bin/activate
$ pip install -r requirements.txt

3. Create both ./pasteme/local_settings.py and .env files and write the following contents in them.

$ touch ./pasteme/local_settings.py && touch .env
# local_settings.py
DEBUG = True
ALLOWED_HOSTS = []

Generate a new Django SECRET_KEY using Djecrety and paste it in the .env file in the root path of the project as follows.

SECRET_KEY=<COPIED SECRET_KEY HERE>

4. PlanetScale database setup (Optional)

In order to use PlanetScale databases as your backend database,

  • Create a new account on https://planetscale.com
  • Create your first database
  • Get the credentials (By pressing the "Connect" button in the dashboard)

and run the following command in the root path of your project.

$ git clone https://github.com/planetscale/django_psdb_engine.git && rm -rf django_psdb_engine/.git

Open the early-modified local_settings.py file. Use the credentials and add the following DATABASES configuration at the end of the file.

DATABASES = {
  'default': {
    'ENGINE': 'django_psdb_engine',
    'NAME': <DB NAME>,
    'HOST': <HOST NAME>,
    'PORT': <PORT>,
    'USER': <USER>,
    'PASSWORD': <PASSWORD>,
    'OPTIONS': {'ssl': {'ca': '/etc/ssl/certs/ca-certificates.crt', 'charset': 'utf8mb4'}
  }
}

Optional: Since python-decouple is one of the required packages, you can also use this package to keep your PlanetScale database configurations safe.

5. Finally, migrate the make-ready migrations and start the service.

$ python manage.py migrate
$ python manage.py runserver

Check out http://localhost:8000 for the result!

Technologies & Services

License

PasteMe is being licensed under the MIT License.

Special Thanks to

About

⚡ RESTful Pastebin Service for @Hashnode via @planetscale

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 46.0%
  • HTML 44.9%
  • CSS 6.6%
  • Dockerfile 1.6%
  • JavaScript 0.9%
0