0

Am implementing a sign up using python & mysql.

Am getting the error no module named flask.ext.mysql and research implies that i should install flask first. They say it's very simple, you simply type

pip install flask-mysql

but where do i type this? In mysql command line for my database or in the python app?

  • Enter that command into a command line, not in your actual source code. If you are using windows, use command prompt. – user3483203 Feb 07 '18 at 18:58

2 Answers2

0

Pip is used from the command line. If you are on a Linux/Mac machine, type it from the Terminal. Make sure you actually have Pip.

If you don't, use this command (on the Terminal) on linux:

sudo apt-get install pip

If you are on a Mac, use (in the Terminal):

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

then:

brew install pip

After doing that on Mac/Linux, you can go ahead and execute the command:

pip install flask-mysql

If you are on a Windows machine, read this instead: How do I install pip on Windows?

Hope this helped!

Marti157
  • 61
  • 1
  • 7
  • I'm neither using windows or mac. At least not directly. Am using the editors & servers at pythonanywhere.com. – Biashara Employers Feb 08 '18 at 11:59
  • In that case, read this. It specifies how to make a virtual env in Python Anywhere and then you can use Pip: https://help.pythonanywhere.com/pages/Flask/ Also, if you are developing a big project like this I recommend using python locally. It just works better and you have way more options. – Marti157 Feb 08 '18 at 12:03
  • Will i have an easy time going live if i develop locally? As in uploading of files and configuring and such stuff? – Biashara Employers Feb 08 '18 at 12:09
  • Sure! You just have to develop the python files and then you can run them anywhere: on python locally or in the web. I really recommend python locally (from the command line) and then installing any packages with Pip. – Marti157 Feb 08 '18 at 12:19
  • Thanks Marti. I've activated the vrtlenv from the bash console. But could you give me software pack suggestions for running python locally? – Biashara Employers Feb 09 '18 at 18:20
  • And what is the difference between running my project with the vtlenv activated and running without the bash? thanks. – Biashara Employers Feb 09 '18 at 18:23
  • So for the latter question, i don’t think there is much of a diference and I’m not much of an expert. If you want to set up Python locally, first download it from the oficial page (on windows) then set the command for the PATH to use with CMD. On mac/linux you already have python 2. Then, use Sublime text or Atom for developing. Finally install Pip and any packages you want. – Marti157 Feb 09 '18 at 18:33
  • Thanks a lot. You're tha best. – Biashara Employers Feb 13 '18 at 14:41
  • Am using sqllite3 for my project now. I've already captured the fields from html and soon i'll be passing them to the database. – Biashara Employers Feb 13 '18 at 14:42
  • Great :) and Good luck! – Marti157 Feb 13 '18 at 16:22
  • Hi Marti. am having trouble sending my form to the database. Internal Server Error. Can you help me submit the HTML form to the sq lite database? appreciate it. – Biashara Employers Feb 14 '18 at 16:47
  • Databases are not my strong point really. Make another post for this error. Make it good or you won’t get any answers though. Remember to set this post to solution if it worked. – Marti157 Feb 14 '18 at 17:53
  • how do i set this post to solved. i tried but couldn't find it. – Biashara Employers Feb 14 '18 at 18:00
  • @BiasharaEmployers Accept the answer that helped you the most (select the checkmark beneath the voting arrows on the left). – Modus Tollens Feb 14 '18 at 18:02
  • @ModusTollens I did it. – Biashara Employers Feb 14 '18 at 18:20
  • @Marti157 I've added the sq lite3 database question on https://stackoverflow.com/questions/48794319/python-internal-server-error-after-html-form-submit. – Biashara Employers Feb 14 '18 at 18:58
-1

You should be able to type it in the command line for your operating system (ie. CMD/bash/terminal) as long as you have pip installed and the executable location is in your PATH.

  • I haven't installed anything. I am using pythonanywhere.com and my options as i see them are: 1. I run the python file and enter pip install mysql in the console or 2. I connect to the database and when the mysql--> command line loads, I enter pip install mysql(I've done this before but there are no signs of success. I't just another blank line) – Biashara Employers Feb 08 '18 at 12:00
  • @BiasharaEmployers Open a Bash console (not a Python one - you should find a button on the bottom left of the dashboard that says "$ Bash") and enter `pip install --user flask-mysql`. See https://help.pythonanywhere.com/pages/InstallingNewModules/ – Erik McLaughlin Feb 08 '18 at 14:39
  • i've done it. and i've finnaly installed mysql alchemy. But why should i activate the vtlenv everytime? and must i keep installing alchemy for it to work? – Biashara Employers Feb 09 '18 at 18:21