{"id":18416829,"url":"https://github.com/tomtom828/python-code-along","last_synced_at":"2026-05-04T15:32:00.399Z","repository":{"id":137822313,"uuid":"81280201","full_name":"tomtom828/python-code-along","owner":"tomtom828","description":"Following along with a Scotch.io tutorial to learn the ins and outs of Python's Flask framework.","archived":false,"fork":false,"pushed_at":"2017-07-01T03:18:22.000Z","size":3094,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-13T05:25:06.674Z","etag":null,"topics":["flask","python","python-2"],"latest_commit_sha":null,"homepage":"http://tom-first-flask-project.herokuapp.com/","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/tomtom828.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}},"created_at":"2017-02-08T02:50:45.000Z","updated_at":"2017-02-10T05:41:20.000Z","dependencies_parsed_at":"2024-01-22T13:25:38.853Z","dependency_job_id":null,"html_url":"https://github.com/tomtom828/python-code-along","commit_stats":null,"previous_names":["tomtom828/python-code-along"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tomtom828/python-code-along","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomtom828%2Fpython-code-along","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomtom828%2Fpython-code-along/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomtom828%2Fpython-code-along/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomtom828%2Fpython-code-along/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomtom828","download_url":"https://codeload.github.com/tomtom828/python-code-along/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomtom828%2Fpython-code-along/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278811887,"owners_count":26050191,"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","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["flask","python","python-2"],"created_at":"2024-11-06T04:07:29.291Z","updated_at":"2025-10-07T17:21:11.633Z","avatar_url":"https://github.com/tomtom828.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# :snake: Python Code Along\n\nAfter completing the [Codecademy Course](https://www.codecademy.com/learn/python) for Python, I wanted to get some hands on experience using a Python framework so I followed a great tutorial on [scotch.io](https://scotch.io/). This application uses Python 2.7.X.\n\n\nThe application is deployed to Heroku [here](http://tom-first-flask-project.herokuapp.com/)!\n\n\nThis is a simple Web App that uses the [Flask](http://flask.pocoo.org/) microframework and connects to a MySQL database and performs simple CRUD actions via [MySQL-Python](https://pypi.python.org/pypi/MySQL-python/1.2.5) and the [Flask-sqlalchemy ORM](http://flask-sqlalchemy.pocoo.org/2.1/). Database migrations use [Flask-Migrate](https://flask-migrate.readthedocs.io/en/latest/). It also performs user authentication using [Flask-Login](https://flask-login.readthedocs.io/en/latest/) and secures forms with [Flask-WTF](https://flask-wtf.readthedocs.io/en/stable/).\n\n\nAs of right now, the application is at the end of Part 1 of the code along. But it was deployed in that state, so it features sign up and login pages as well as an authenicated dashboard page.\n\n\nWhat was not covered in the Tutorial was deploying the webpage to Heroku (but it does cover deploying to a different service). I have documented a Heroku deployment here. Assuming you have the Heroku CLI set up, then this should document the whole process.\n\n\n\n\n## Running Locally\n\nIn the project folder, install all the requirements dependencies.\n\n  ```\n    $ pip install -r requirements.txt\n  ```\n\n\nInside the `instance` folder, rename the `config.test.py` file to `config.py`. \nThen, add the proper connection information for your MYSQL database.\n\n\nAssuming you have virtualenv virtualenvwrapper, initiliaze a virtual envirnoment.\n\n  ```\n    $ export WORKON_HOME=~/Envs\n    $ source /usr/local/bin/virtualenvwrapper.sh\n    $ mkvirtualenv my-venv\n    $ workon my-venv\n  ```\n\n\nIn the project folder, configure the environment variables.\nNote that Windows user may need to use `set` instead of `export`.\n\n  ```\n    $ export FLASK_CONFIG=development\n    $ export FLASK_APP=run.py\n    $ flask run\n  ```\n\n\nIn order to perform the Database migrations, you will need to use MySQL to `CREATE DATABASE dreamteam_db;` and then call the migratrion from the command line using `$ flask db upgrade`.\n\n\n\n## Deployment to Heroku\n\nThis assumes that you have the Heorku CLI set up and have deployed to the service in the past, maybe in a different programming language. More in depth info on basics can be found in this [Tutorial](http://kennmyers.github.io/tutorial/2016/03/11/getting-flask-on-heroku.html) for Python's Flask Deployment.\n\n\nOnce your project is initilized in Heroku, go to your Heroku dashboard and click on the Heroku Add Ons. In this case, we want the Free JawsDB Add On to support the MySQL features of the app. Once JawsDB is added, click on JawsDB icon in Heroku to navigate to their page. The JawsDB page will show you your connection information. Add the database connection string to the production case in the `instance/config.py` file. The production case is under the `else` statement.\n\n\nYou can also use the database connection information from JawsDB to create a `New Connection` in MySQL WorkBench (if you have that installed. Since we use the SQLAlchemy ORM, though, we can force our migration (without MySQL WorkBench) using the hacky approach below. First, we set the local envirnoment variable to production, which will cause our database to connect to the JawsDB database instead of the local database. Then we run the migration, knowing we are connected to the JawsDB account. Finally, we set the local evironment variable back to development to prevent messing up the deployed database in the future. \n\n  ```\n    export FLASK_CONFIG=production\n    flask db upgrade\n    export FLASK_CONFIG=development\n\n  ```\n\n\nWith the JawsDB, database set up, we can finally deploy the app for real. Using a buildpack finally got the app working for me, so I suggest that you use it as well. Below, are the BASH commands that I used to successfully deploy to Heroku.\n\n  ```\n     $ heroku config:add BUILDPACK_URL=https://github.com/kennethreitz/conda-buildpack.git\n     $ heroku config:set FLASK_CONFIG=production\n     $ git push heroku master\n  ```\n\n\nAnd that should do it! Your app **should be** deployed, complete with working Log In and Register features thanks to JawsDB. If you have issues, be sure to `git add .`, `git commit -m \"your edits\"`, and `git push origin master` before trying to deploy again via `git push heroku master`.\n\n\n\n## Resources\n\n[Set Up Virtual Env and Flask](https://scotch.io/tutorials/getting-started-with-flask-a-python-microframework)\n\n[CRUD Web App with Flask - Part 1](https://scotch.io/tutorials/build-a-crud-web-app-with-python-and-flask-part-one)\n\n[CRUD Web App with Flask - Part 2](https://scotch.io/tutorials/build-a-crud-web-app-with-python-and-flask-part-two)\n\n[CRUD Web App with Flask - Part 3](https://scotch.io/tutorials/build-a-crud-web-app-with-python-and-flask-part-three)\n\n\n\n## Screenshots\n\n#### Home Page\n![HomePage](/screenshots/HomePage.png)\n\n#### Login Page\n![Log In Page](/screenshots/LoginPage.png)\n\n#### Registration Page\n![Register Page](/screenshots/RegisterPage.png)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomtom828%2Fpython-code-along","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomtom828%2Fpython-code-along","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomtom828%2Fpython-code-along/lists"}