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!
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$ git clone https://github.com/collove/pasteme.git && cd ./pasteme$ virtualenv venv && source venv/bin/activate
$ pip install -r requirements.txt$ 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>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/.gitOpen 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.
$ python manage.py migrate
$ python manage.py runserverCheck out http://localhost:8000 for the result!
- Frameworks and Tools
- Infrastructures & Hosting Services
PasteMe is being licensed under the MIT License.