- License
GPLv3
URL shortener made with Django.
The project requirements can be found at requirements.pdf
.
Obs: the domain name is currently set as 0.0.0.0:8000
Create URL:
Path: /
Allow: POST, OPTIONS
Content-Type: application/json
Vary: Accept
{
"name": "Create Url",
"description": "Endpoint for creating short URLs.
Parameters:
original (str): original url
code (str): desired url code (optional)
expires (str): desired expiry date (ISO 8601) (optional)
Returns:
(str): code of the short URL
(str): expiration date",
"renders": [
"application/json",
"text/html"
],
"parses": [
"application/json",
"application/x-www-form-urlencoded",
"multipart/form-data"
]
}
Retrieve URL:
Path: /<short_code>
Allow: GET, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept
{
"name": "Retrieve Url Instance",
"description": "Endpoint for retrieving a URL from its short code.
Parameters:
code (str): short code
Returns:
(str): url redirect, if it exists",
"renders": [
"application/json",
"text/html"
],
"parses": [
"application/json",
"application/x-www-form-urlencoded",
"multipart/form-data"
]
}
The admin page is accessible at /adm/
URL storage is done with a Postgres container.
Expired URLs are removed from the database when requested via either API endpoint.
Moved to settings.
- To create a normal user account, just go to Sign Up and fill out the form. Once you submit it, you'll see a "Verify Your E-mail Address" page. Go to your console to see a simulated email verification message. Copy the link into your browser. Now the user's email should be verified and ready to go.
To create an superuser account, use this command:
$ python manage.py createsuperuser
For convenience, you can keep your normal user logged in on Chrome and your superuser logged in on Firefox (or similar), so that you can see how the site behaves for both kinds of users.
Running type checks with mypy:
$ mypy url_shortener
To run the tests, check your test coverage, and generate an HTML coverage report:
$ coverage run -m pytest
$ coverage html
$ open htmlcov/index.html
$ pytest
Moved to Live reloading and SASS compilation.
The following details how to deploy this application.
See detailed cookiecutter-django Docker documentation.
Dev environment deployment:
$ docker-compose -f local.yml build
$ docker-compose -f local.yml up