Giter Site home page Giter Site logo

circleci-public / circleci-demo-python-flask Goto Github PK

View Code? Open in Web Editor NEW
85.0 29.0 228.0 4.06 MB

A demo application to learn how to use CircleCI

Home Page: https://circleci.com/gh/CircleCI-Public/circleci-demo-python-flask

License: MIT License

Python 79.97% CSS 1.77% HTML 17.28% Mako 0.47% Shell 0.48% Procfile 0.02%
circleci demo-app tutorial walkthrough python flask heroku demo circleci-demos

circleci-demo-python-flask's Issues

Fix latest failed CirCleCI build

As title, it seems that the latest CirCleCI build is failed.

And I think it should be fixed/concerned.

Once this issue is accepted, I can work on this and please add #orbtoberfest on this issue because of the hacktoberfest circleci :).

Heroku API Key and Forking

TL;DR: Make a note to walkthrough users that they will have to add their Heroku API Key to CircleCI before starting or the first error wont look like the walkthrough. You will get this:

if [ "${CIRCLE_BRANCH}" == "master" ]; then
  git push heroku master
  heroku run python manage.py deploy
  heroku restart
fi
Shell: /bin/bash -eo pipefail

Username for 'https://git.heroku.com': fatal: could not read Username for 'https://git.heroku.com': No such file or directory
Exited with code 128

Adding the key will get you the expected first error.

Also: When forking, make sure to change project name to not conflict on Heroku with the tutorial instance which has the 'cci-demo-walkthrough' namespace occupied.

python manage.py deploy ... error with db

on a MacOS Mojave 10.14.6

I followed Readme:
postgreSQL 9.6 (running and created database circulate)
venv activated
installed requirements.txt

python manage.py deploy --> error:
(venv) (base) Kelles-MacBook-Air-2:circleci-demo-python-flask kelleclark$ python manage.py deploy
INFO [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO [alembic.runtime.migration] Will assume transactional DDL.
Traceback (most recent call last):
File "manage.py", line 83, in
manager.run()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/flask_script/init.py", line 412, in run
result = self.handle(sys.argv[0], sys.argv[1:])
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/flask_script/init.py", line 383, in handle
res = handle(*args, **config)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/flask_script/commands.py", line 216, in call
return self.run(*args, **kwargs)
File "manage.py", line 76, in deploy
Role.insert_roles()
File "/Users/kelleclark/Documents/CI_practice/circleci-demo-python-flask/app/models.py", line 42, in insert_roles
role = Role.query.filter_by(name=r).first()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 3214, in first
ret = list(self[0:1])
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 3006, in getitem
return list(res)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 3316, in iter
return self._execute_and_instances(context)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 3341, in _execute_and_instances
result = conn.execute(querycontext.statement, self._params)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 988, in execute
return meth(self, multiparams, params)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sqlalchemy/sql/elements.py", line 287, in _execute_on_connection
return connection._execute_clauseelement(self, multiparams, params)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1107, in _execute_clauseelement
distilled_params,
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1248, in _execute_context
e, statement, parameters, cursor, context
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1466, in _handle_dbapi_exception
util.raise_from_cause(sqlalchemy_exception, exc_info)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 383, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb, cause=cause)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1244, in _execute_context
cursor, statement, parameters, context
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 552, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.ProgrammingError: (psycopg2.ProgrammingError) relation "roles" does not exist
LINE 2: FROM roles
^

[SQL: SELECT roles.id AS roles_id, roles.name AS roles_name, roles."default" AS roles_default, roles.permissions AS roles_permissions
FROM roles
WHERE roles.name = %(name_1)s
LIMIT %(param_1)s]
[parameters: {'name_1': 'Moderator', 'param_1': 1}]
(Background on this error at: http://sqlalche.me/e/f405)

What I did ...
It seemed like the table for roles hadnt been created...and I saw that in the testing they created some data by using

db.create_all()

so in manage.py, I added db.create:
@manager.command
def deploy():
"""Run deployment tasks."""
from flask_migrate import upgrade
from app.models import Role, User
db.create_all()

Now seems to be ok....

(venv) (base) Kelles-MacBook-Air-2:circleci-demo-python-flask kelleclark$ python manage.py deploy
INFO [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO [alembic.runtime.migration] Will assume transactional DDL.
(venv) (base) Kelles-MacBook-Air-2:circleci-demo-python-flask kelleclark$ python manage.py runserver

  • Serving Flask app "app" (lazy loading)
  • Environment: production
    WARNING: Do not use the development server in a production environment.
    Use a production WSGI server instead.
  • Debug mode: on
  • Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
  • Restarting with stat
  • Debugger is active!
  • Debugger PIN: 174-714-230

sample config.yml job

In the job section of walkthrough, consider changing the working_directory from ~/circulate to ~/. For noobs, this is not evident since 'circulate' is not the name of the demo project.

In config.yml:

version: 2
jobs:
  build:
    working_directory: ~/<project-root>
    docker:
      - image: python:3.6.0
    steps:
      - checkout
      - run: echo "hello world"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.