title: ValueError: invalid literal for int() with base 10: '\\Users\\Padma Jain\\python\\flask\\flask_login\\app\\data.sqlite'
body: <p>I am learning flask-login package. When I run <code>flask db init</code>, I don't get any errors. But this is the error i get when i run <code>flask db migrate -m &quot;creating users&quot;</code>:</p>
  <pre><code>Traceback (most recent call last):
    File &quot;c:\users\padma jain\appdata\local\programs\python\python37\lib\runpy.py&quot;, line 193, in _run_module_as_main
      &quot;__main__&quot;, mod_spec)
    File &quot;c:\users\padma jain\appdata\local\programs\python\python37\lib\runpy.py&quot;, line 85, in _run_code
      exec(code, run_globals)
    File &quot;C:\Users\Padma Jain\AppData\Local\Programs\Python\Python37\Scripts\flask.exe\__main__.py&quot;, line 7, in &lt;module&gt;
    File &quot;c:\users\padma jain\appdata\local\programs\python\python37\lib\site-packages\flask\cli.py&quot;, line 967, in main
      cli.main(args=sys.argv[1:], prog_name=&quot;python -m flask&quot; if as_module else None)  
    File &quot;c:\users\padma jain\appdata\local\programs\python\python37\lib\site-packages\flask\cli.py&quot;, line 586, in main
      return super(FlaskGroup, self).main(*args, **kwargs)
    File &quot;c:\users\padma jain\appdata\local\programs\python\python37\lib\site-packages\click\core.py&quot;, line 782, in main
      rv = self.invoke(ctx)
    File &quot;c:\users\padma jain\appdata\local\programs\python\python37\lib\site-packages\click\core.py&quot;, line 1259, in invoke
      return _process_result(sub_ctx.command.invoke(sub_ctx))
    File &quot;c:\users\padma jain\appdata\local\programs\python\python37\lib\site-packages\click\core.py&quot;, line 1259, in invoke
      return _process_result(sub_ctx.command.invoke(sub_ctx))
    File &quot;c:\users\padma jain\appdata\local\programs\python\python37\lib\site-packages\click\core.py&quot;, line 1066, in invoke
      return ctx.invoke(self.callback, **ctx.params)
    File &quot;c:\users\padma jain\appdata\local\programs\python\python37\lib\site-packages\click\core.py&quot;, line 610, in invoke
      return callback(*args, **kwargs)
    File &quot;c:\users\padma jain\appdata\local\programs\python\python37\lib\site-packages\click\decorators.py&quot;, line 21, in new_func
      return f(get_current_context(), *args, **kwargs)
    File &quot;c:\users\padma jain\appdata\local\programs\python\python37\lib\site-packages\flask\cli.py&quot;, line 426, in decorator
      return __ctx.invoke(f, *args, **kwargs)
    File &quot;c:\users\padma jain\appdata\local\programs\python\python37\lib\site-packages\click\core.py&quot;, line 610, in invoke
      return callback(*args, **kwargs)
    File &quot;c:\users\padma jain\appdata\local\programs\python\python37\lib\site-packages\flask_migrate\cli.py&quot;, line 92, in migrate
      rev_id, x_arg)
    File &quot;c:\users\padma jain\appdata\local\programs\python\python37\lib\site-packages\flask_migrate\__init__.py&quot;, line 96, in wrapped
      f(*args, **kwargs)
    File &quot;c:\users\padma jain\appdata\local\programs\python\python37\lib\site-packages\flask_migrate\__init__.py&quot;, line 212, in migrate
      version_path=version_path, rev_id=rev_id)
    File &quot;c:\users\padma jain\appdata\local\programs\python\python37\lib\site-packages\alembic\command.py&quot;, line 212, in revision
      script_directory.run_env()
    File &quot;c:\users\padma jain\appdata\local\programs\python\python37\lib\site-packages\alembic\script\base.py&quot;, line 490, in run_env
      util.load_python_file(self.dir, &quot;env.py&quot;)
    File &quot;c:\users\padma jain\appdata\local\programs\python\python37\lib\site-packages\alembic\util\pyfiles.py&quot;, line 97, in load_python_file
      module = load_module_py(module_id, path)
    File &quot;c:\users\padma jain\appdata\local\programs\python\python37\lib\site-packages\alembic\util\compat.py&quot;, line 182, in load_module_py
      spec.loader.exec_module(module)
    File &quot;&lt;frozen importlib._bootstrap_external&gt;&quot;, line 728, in exec_module
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 219, in _call_with_frames_removed
    File &quot;migrations\env.py&quot;, line 25, in &lt;module&gt;
      str(current_app.extensions['migrate'].db.engine.url).replace('%', '%%'))
    File &quot;c:\users\padma jain\appdata\local\programs\python\python37\lib\site-packages\flask_sqlalchemy\__init__.py&quot;, line 943, in engine
      return self.get_engine()
    File &quot;c:\users\padma jain\appdata\local\programs\python\python37\lib\site-packages\flask_sqlalchemy\__init__.py&quot;, line 962, in get_engine
      return connector.get_engine()
    File &quot;c:\users\padma jain\appdata\local\programs\python\python37\lib\site-packages\flask_sqlalchemy\__init__.py&quot;, line 554, in get_engine
      sa_url = make_url(uri)
    File &quot;c:\users\padma jain\appdata\local\programs\python\python37\lib\site-packages\sqlalchemy\engine\url.py&quot;, line 229, in make_url
      return _parse_rfc1738_args(name_or_url)
    File &quot;c:\users\padma jain\appdata\local\programs\python\python37\lib\site-packages\sqlalchemy\engine\url.py&quot;, line 288, in _parse_rfc1738_args
      return URL(name, **components)
    File &quot;c:\users\padma jain\appdata\local\programs\python\python37\lib\site-packages\sqlalchemy\engine\url.py&quot;, line 71, in __init__
      self.port = int(port)
  ValueError: invalid literal for int() with base 10: '\\Users\\Padma Jain\\python\\flask\\flask_login\\app\\data.sqlite'
  </code></pre>
  <p>Here is my <code>app.py</code></p>
  <pre><code># app.py
  
  from app import app, db
  from flask import render_template, flash, redirect, request, url_for
  from flask_login import login_user, logout_user, login_required
  from app.models import User
  from app.forms import RegistrationForm, LoginForm
  
  @app.route(&quot;/&quot;)
  def home():
      return render_template(&quot;index.html&quot;)
  
  @app.route(&quot;/welcome&quot;)
  @login_required
  def welcome_user():
      return render_template(&quot;welcome-user.html&quot;)
  
  @app.route(&quot;/logout&quot;)
  @login_required
  def logout():
      logout_user()
      flash(&quot;Logged out successfully&quot;)
      return redirect(url_for('home'))
  
  @app.route(&quot;/login&quot;, methods = [&quot;GET&quot;, &quot;POST&quot;])
  def login():
      
      form = LoginForm()
      if form.validate_on_submit():
          user = User.query.filter_by(email=form.email.data).first()
  
          if user.check_password(form.password.data) and user is not None:
              login_user(user)
              flash(&quot;Logged in successfully!&quot;)
              next = request.args.get(&quot;next&quot;)
  
              if next == None or not next[0] == '/':
                  next = url_for('welcome_user')
              
              return redirect(next)
  
      return render_template(&quot;login.html&quot;,form=form)
  
  @app.route(&quot;/register&quot;,methods=[&quot;GET&quot;,&quot;POST&quot;])
  def register():
      form = RegistrationForm()
      
      if form.validate_on_submit():
          user = User(email=form.email.data,
                      username=form.username.data,
                      password=form.password.data)
          db.session.add(user)
          db.session.commit()
          flash(&quot;Created account successfully&quot;)
          return redirect(url_for('login'))
  
      return render_template(&quot;register.html&quot;)
  
  if __name__ == &quot;__main__&quot;:
      app.run(debug=True)
  </code></pre>
  <p><strong>init</strong>.py:</p>
  <pre><code># __init__.py
  
  import os
  from flask import Flask
  from flask_sqlalchemy import SQLAlchemy
  from flask_migrate import Migrate
  from flask_login import LoginManager
  
  login_manager = LoginManager()
  
  app = Flask(__name__)
  app.config['SECRET_KEY'] = 'thisismysecretkeydontstealit'
  basedir = os.path.abspath(os.path.dirname(__file__))
  app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite://' + os.path.join(basedir,'data.sqlite')
  app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
  
  db = SQLAlchemy(app)
  Migrate(app, db)
  
  login_manager.init_app(app)
  login_manager.login_view = 'login'
  </code></pre>
  <p><code>models.py</code></p>
  <pre><code># models.py
  
  from app import db, login_manager
  from werkzeug.security import generate_password_hash, check_password_hash
  from flask_login import UserMixin
  
  @login_manager.user_loader
  def load_user(user_id):
      return User.query.get(user_id)
  
  class User(db.Model, UserMixin):
  
      __tablename__ = 'users'
      id = db.Column(db.Integer, primary_key = True)
      email = db.Column(db.String(64),unique = True, index = True)
      username = db.Column(db.String(64), unique=True, index=True)
      password_hash = db.Column(db.String(128))
  
      def __init__(self):
          self.email = email
          self.username = username
          self.password_hash = generate_password_hash(password)
  
      def check_password(self):
          return check_password_hash(self.check_password_hash, password)
  </code></pre>
  <p>Please help me</p>