How do I set up a login system in pyramid using mysql as database to store email and password?
<p>I have gone through this <a href="http://docs.pylonsproject.org/projects/pyramid/en/latest/quick_tutorial/authentication.html" rel="nofollow">http://docs.pylonsproject.org/projects/pyramid/en/latest/quick_tutorial/authentication.html</a> but it does not give any clue how to add database to this to store email and password?</p>

<p>Here are a few suggestions regarding switching from SQLite to MySQL. In your <code>development.ini</code> (and/or <code>production.ini</code>) file, change from SQLite to MySQL:</p>

<pre><code># sqlalchemy.url = sqlite:///%(here)s/MyProject.sqlite  [comment out or remove this line]
sqlalchemy.url = mysql://MySQLUsername:MySQLPassword@localhost/MySQLdbName
</code></pre>

<p>Of course, you will need a MySQL database (<code>MySQLdbName</code> in the example above) and likely the knowledge and privileges to edit its metadata, for example, to add fields called <code>user_email</code> and <code>passwordhash</code> to the <code>users</code> table or create a <code>users</code> table if necessary.</p>

<p>In your <code>setup.py</code> file, you will require the <code>mysql-python</code> module to be imported.  An example would be:</p>

<pre><code>requires = [
    'bcrypt',
    'pyramid',
    'pyramid_jinja2',
    'pyramid_debugtoolbar',
    'pyramid_tm',
    'SQLAlchemy',
    'transaction',
    'zope.sqlalchemy',
    'waitress',
    'mysql-python',
    ]
</code></pre>

<p>After specifying new module(s) in <code>setup.py</code>, be sure to run the following commands so your project recognizes the new module(s):</p>

<pre><code>cd $VENV/MyPyramidProject
sudo $VENV/bin/pip install -e .
</code></pre>

<p>By this point, your Pyramid project should be hooked up to MySQL.  Now it is down to learning the details of Pyramid (and SQLAlchemy if this is your selected ORM).  Much of the suggestions in the tutorials, partcularly the <a href="http://docs.pylonsproject.org/projects/pyramid/en/latest/tutorials/wiki2/index.html" rel="nofollow">SQLAlchemy + URL dispatch wiki tutorial</a> in your case, should work as they work with SQLite.</p>

python authentication pyramid