Help with SQL commands to interact with a MySQL database
- Mac /usr/local/mysql/bin
- Windows /Program Files/MySQL/MySQL version/bin
- Xampp /xampp/mysql/bin
| 4. | |
| pipenv install flask-sqlalchemy | |
| python | |
| from flaskblog import db | |
| db.create_all() | |
| from flaskblog import User, Post | |
| user_1 = User(username='Corey', email='C@demo.com', password='password') | |
| db.session.add(user_1) | |
| user_2 = User(username='JohnDoe', email='jd@demo.com', password='password') | |
| db.session.add(user_2) |
| https://forums.linuxmint.com/viewtopic.php?f=47&t=265925&p=1445406&hilit=phpmyadmin#p1445406 | |
| https://www.a2hosting.com/kb/developer-corner/mysql/managing-mysql-databases-and-users-from-the-command-line | |
| cd /etc/apache2/sites-available | |
| cp 000-default.conf <name_of_site>.conf | |
| sudo gedit <name_of_site>.conf | |
| Add the path for virtual host | |
| sudo a2enmod rewrite | |
| sudo a2ensite <name_of_site>.conf | |
| sudo service apache2 restart | |
| sudo gedit /etc/hosts | |
| enter the created site | |
| 127.0.0.1 <name_of_site>.conf |
| To install postgresql | |
| sudo apt-get install postgresql-10 | |
| To check the command you can use for postgresql | |
| service postgresql | |
| postgresql commands | |
| service postgresql status = check the status | |
| C | |
| Login in to postgresql |
| Installing environment | |
| python3 -m venv ./venv = to create virtual environment | |
| pip3 freeze = to check the package installed on your environment or global | |
| source ./venv/bin/activate = to activate virtual environment (you dont need to use python3, you can now use python) | |
| deactivate = to get out of virtual environment | |
| Installing Django | |
| pip install django | |
| django-admin = helps you customize django | |
| django-admin startproject <projectname> . = create django project inside the current directory |
| #!/bin/bash | |
| ##################################################### | |
| # Name: Bash CheatSheet for Mac OSX | |
| # | |
| # A little overlook of the Bash basics | |
| # | |
| # Usage: | |
| # | |
| # Author: J. Le Coupanec | |
| # Date: 2014/11/04 |