{"id":16208138,"url":"https://github.com/verdan/django-url-shortener","last_synced_at":"2025-04-07T20:23:36.954Z","repository":{"id":72984088,"uuid":"83337509","full_name":"verdan/django-url-shortener","owner":"verdan","description":null,"archived":false,"fork":false,"pushed_at":"2019-05-14T08:56:02.000Z","size":1324,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-02-13T21:49:36.658Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/verdan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-27T17:25:15.000Z","updated_at":"2017-02-27T17:26:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"fb8b754f-d198-49fb-af86-71a743d2bb16","html_url":"https://github.com/verdan/django-url-shortener","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/verdan%2Fdjango-url-shortener","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/verdan%2Fdjango-url-shortener/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/verdan%2Fdjango-url-shortener/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/verdan%2Fdjango-url-shortener/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/verdan","download_url":"https://codeload.github.com/verdan/django-url-shortener/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247722653,"owners_count":20985230,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T10:15:28.929Z","updated_at":"2025-04-07T20:23:36.924Z","avatar_url":"https://github.com/verdan.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Django URL Shortener\n====================\n\nCustomised Django URL Shortener. It uses a list of predefined words related to the actual url instead of random alpha-numeric word.\n\nURL Shortening Scheme\n---------------------\n\nIt is common for URL shortening services to create a unique key consisting of the characters a-z, A-Z, 0-9, so that a\nkey could be a74Bd and the corresponding shortened URL would then be http://myurlshortener.com/a74Bd.\nWe will not follow this scheme, but instead make use of a word list (you should have gotten a file called words.txt).\nThe key we use will always be a word from this word list.\n\nWordlist\n--------\n\nYou must clean the wordlist yourself by converting all words to lowercase, and remove any characters that are\nnot [0-9a-z]. Create a shell command that cleans the wordlist and loads it into the database.\nWhen a new request to shorten a URL comes from the form on the front page, the application should make a key by\ntrying to pick a word from the wordlist that exists in the URL.\nThe algorithm that picks a word from the wordlist should be fast and not take several seconds.\nFor example, if a user enters the URL http://techcrunch.com/2012/12/28/pinterest-lawsuit/ it should pick the first word\nin the wordlist that is a part of this URL. I haven’t checked myself, but I would guess that the word in this case\nwould be “lawsuit”. If none of the words in the wordlist is a part of the URL, or if all words in the wordlist that\nare part of the URL are already used for shortening other URLs, any word from the wordlist should be used. When all the words in the\nwordlist have been used up as keys, the oldest existing key/URL should be deleted and that key should be reused for new URL submissions.\n\nExample\nI enter the URL http://techcrunch.com/2012/12/28/pinterest-lawsuit/ into the field on the frontpage and press enter.\nThe shortened URL I get back on the result page would then be http://myurlshortener.com/lawsuit/ if lawsuit is the first word\nin the wordlist that is part of the URL and that is not already used for any other shortened URL.\nIf I would then go to the front page again and enter the URL http://lawsuit.se the shortened URL could be\nhttp://myurlshortener.com/windmill/, as no unused word in the wordlist was part of the URL and the application picked a random word from the wordlist.\n\nGetting Started\n---------------\n\nI'm assuming you have Python installed. It is preferable to have a virtual environment for the project libraries.\nAlso assuming you've git setup on your system.\n\nSetting Up the Virtual Environment (skip this if you want to mess-up your python libraries :P)\n-------------------------------------------------------------------------------------------\n\nIf you're using pip to install packages (and I can't see why you wouldn't), you can get both virtualenv and virtualenvwrapper by simply installing the latter.\n\n            pip install virtualenvwrapper\n\nAfter it's installed, add the following lines to your shell's start-up file (.zshrc, .bashrc, .profile, etc).\n\n            export WORKON_HOME=$HOME/.virtualenvs\n            export PROJECT_HOME=$HOME/directory-you-do-development-in\n            source /usr/local/bin/virtualenvwrapper.sh\n\nReload your start up file (e.g. source .bashrc) and you're ready to go.\n\nCreating a virtual environment is simple. Just type\n\n            mkvirtualenv short\n\nor If already created the Virtual Environment, just start the environment by typing\n\n            workon short\n\n\nGetting the App Running\n-----------------------\n\nInstalling Python Packages and getting the app running is just like eating chocolate.\n\n            cd /path/where/you/want/your/project\n            git clone git@bitbucket.org:verdanmahmood/django-url-shortener.git\n            cd django-url-shortener/\n            \nPackages will be installed with a shell command **install-dev**\nThis command installs the packages in the requirement file, runs the syncdb and migrate commands itself.\n            \n            ./url_shortner.sh install-dev\n            \nStart the Server\n            \n            python manage.py runserver\n            \n### Having Permissions Errors Running Shell Commands ? Try this: \n            cd /path/to/project\n            chmod u+rwx url_shortner.sh\n            \n            \nLoading the Words Database\n--------------------------\n            \nSecret words are placed in the file in fixtures directory in the repository.\nYou can load the words in the database by two ways.\n\nfrom custom management command:\n\n            python manage.py upload_words\n            \nor, by using a shell command.\n            \n            ./url_shortner.sh load-words\n\n            \nFuture Plans\n------------\n\nAdded IP address field in the Tiny URL model to keep track of the users and other reports related stuff.\nCreated Generic Models Manager.\nBase presenter for future implementations of content renderings.\n            \n            ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fverdan%2Fdjango-url-shortener","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fverdan%2Fdjango-url-shortener","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fverdan%2Fdjango-url-shortener/lists"}