Giter Site home page Giter Site logo

briancappello / flask-react-spa Goto Github PK

View Code? Open in Web Editor NEW
543.0 22.0 109.0 3.79 MB

A production-ready boilerplate built with Python 3, Flask and ES6 React/Redux

License: MIT License

Python 57.53% JavaScript 34.50% CSS 1.74% HTML 3.69% Makefile 0.14% Shell 1.06% Ruby 1.03% Mako 0.10% Dockerfile 0.21%

flask-react-spa's Introduction

Flask React SPA

Status

Build Status

screenshot

React v16 Frontend

The frontend is heavily inspired by react boilerplate, and indeed borrows a good chunk of boilerplate from it.

Entry point is at frontend/app/index.js.

Flask Backend

The backend is structured using the Application Factory Pattern, in conjunction with a little bit of declarative configuration in backend/config.py (for ordered registration of extensions, and auto-detection of views, models, serializers, model admins and cli commands). The entry point is the create_app() method in backend/app.py (wsgi.py in production).

Ansible Production Deployment

  • CentOS/RHEL 7.x
  • Python 3.6 (provided by the IUS Project)
  • PostgreSQL 9.6
  • Redis 3.2
  • NGINX + uWSGI + supervisord
  • Lets Encrypt HTTPS
  • Email sending via Postfix with SSL and OpenDKIM

Local Development QuickStart:

Using docker-compose

Dependencies:

  • docker and docker-compose (at least docker engine v1.13)
# install
$ git clone [email protected]:briancappello/flask-react-spa.git
$ cd flask-react-spa

# configure (the defaults are fine for development)
$ edit `backend/config.example.py` and save as `backend/config.py`
$ edit `frontend/app/config.example.js` and save as `frontend/app/config.js`

# run it
$ docker-compose up --build  # grab a coffee; bootstrapping takes a while the first time

Once it's done building and everything has booted up:

Running locally

This assumes you're on a reasonably standard *nix system. Windows might work if you know what you're doing, but you're on your own there.

Dependencies:

  • Python 3.6+
  • Your virtualenv tool of choice (strongly recommended)
  • PostgreSQL or MariaDB (MySQL)
  • Redis (used for sessions persistence and the Celery tasks queue)
  • node.js & npm (v6 or later recommended, only required for development)
  • MailHog (not required, but it's awesome for testing email related tasks)
# install
$ git clone [email protected]:briancappello/flask-react-spa.git
$ cd flask-react-spa
$ mkvirtualenv -p /path/to/python3 flask_react_spa
$ pip install -r requirements.txt
$ pip install -r requirements-dev.txt  # for tests and sphinx docs

# configure
$ edit `backend/config.example.py` and save as `backend/config.py`
$ edit `frontend/app/config.example.js` and save as `frontend/app/config.js`

# set up database
$ sudo -u postgres -i psql
postgres=# CREATE USER flask_api WITH PASSWORD 'flask_api';
postgres=# CREATE DATABASE flask_api;
postgres=# GRANT ALL PRIVILEGES ON DATABASE flask_api TO flask_api;
postgres=# \q  # (quit)

# run db migrations
$ python manage.py db upgrade

# load db fixtures (optional)
$ python manage.py db fixtures fixtures.json

# frontend dev server:
$ npm install
$ npm run start

# backend dev server:
$ python manage.py run

# backend celery workers:
$ python manage.py celery worker
$ python manage.py celery beat

Full Documentation

Run make docs and browse to http://localhost:5500

Sources are in the /docs folder.

FIXME: publish to GitHub Pages.

License

MIT

flask-react-spa's People

Contributors

briancappello avatar chriamue avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flask-react-spa's Issues

Problems with Python3.7

Hi, I need to use Python3.7 with this boilerplate but I been getting these errors when I update from 3.6 to 3.7:

flask-react-spa: python3 manage.py db upgrade
Traceback (most recent call last):
  File "/Users/.../flask-react-spa/backend/magic.py", line 331, in models
    raise StopIteration
StopIteration

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "manage.py", line 62, in <module>
    main()
  File "manage.py", line 58, in main
    cli.main(args=sys.argv[1:])
  File "/Users/.../flask-react-spa/env/lib/python3.7/site-packages/flask/cli.py", line 557, in main
    return super(FlaskGroup, self).main(*args, **kwargs)
  File "/Users/.../flask-react-spa/env/lib/python3.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/Users/.../flask-react-spa/env/lib/python3.7/site-packages/click/core.py", line 1061, in invoke
    cmd_name, cmd, args = self.resolve_command(ctx, args)
  File "/Users/.../flask-react-spa/env/lib/python3.7/site-packages/click/core.py", line 1100, in resolve_command
    cmd = self.get_command(ctx, cmd_name)
  File "/Users/.../flask-react-spa/env/lib/python3.7/site-packages/flask/cli.py", line 515, in get_command
    rv = info.load_app().cli.get_command(ctx, name)
  File "/Users/.../flask-react-spa/env/lib/python3.7/site-packages/flask/cli.py", line 367, in load_app
    app = call_factory(self, self.create_app)
  File "/Users/.../flask-react-spa/env/lib/python3.7/site-packages/flask/cli.py", line 114, in call_factory
    return app_factory(script_info)
  File "manage.py", line 34, in <lambda>
    create_app=lambda _: create_app(),
  File "/Users/.../flask-react-spa/backend/app.py", line 49, in create_app
    static_url_path=STATIC_URL_PATH
  File "/Users/.../flask-react-spa/backend/app.py", line 69, in _create_app
    register_models(app)
  File "/Users/.../flask-react-spa/backend/app.py", line 139, in register_models
      for model_name, model_class in bundle.models:
RuntimeError: generator raised StopIteration

It happens in this method:

def register_models(app):
    """Register bundle models."""
    models = {}
    for bundle in app.bundles:
        for model_name, model_class in bundle.models:
            models[model_name] = model_class
    app.models = models

Some quick Googling shows this:

PEP 479 is enabled for all code in Python 3.7, meaning that StopIteration exceptions raised directly or indirectly in coroutines and generators are transformed into RuntimeError exceptions. (Contributed by Yury Selivanov in bpo-32670.)

Any ideas how to fix this?

enable the wiki to contribute articles

I've spent a few hours with this starter project and think its amazing. It could really help devs like myself become better at the fullstack. I'm frontend strong and backend weak so I'd like to contribute a wiki page how to use to this project to create, edit, and delete an article. I noticed the article list is empty.

Would you mind enabling the wiki option? I also see you have docs so I could add the article there once its done and peer reviewed.

Implementation of Socket

Can anyone help with Flask-SocketIO integration in this project or if someone has prior done it and can share the setup guide

jinja2.exceptions.UndefinedError: 'admin_base_template' is undefined

Hi ,all
Anyone got this error? It's very wired .
I also checkout the project again and rebuild it , it's still same.
I only change the database connection string to my mssql server.
Is a database connect issue ? Or configuration issue ?

stacktrace here

`Traceback (most recent call last):
File "/Users/morewater/pyenv/invoice/lib/python3.7/site-packages/flask/app.py", line 2463, in call
return self.wsgi_app(environ, start_response)
File "/Users/morewater/pyenv/invoice/lib/python3.7/site-packages/flask/app.py", line 2449, in wsgi_app
response = self.handle_exception(e)
File "/Users/morewater/pyenv/invoice/lib/python3.7/site-packages/flask_restful/init.py", line 269, in error_router
return original_handler(e)
File "/Users/morewater/pyenv/invoice/lib/python3.7/site-packages/flask/app.py", line 1866, in handle_exception
reraise(exc_type, exc_value, tb)
File "/Users/morewater/pyenv/invoice/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/Users/morewater/pyenv/invoice/lib/python3.7/site-packages/flask/app.py", line 2446, in wsgi_app
response = self.full_dispatch_request()
File "/Users/morewater/pyenv/invoice/lib/python3.7/site-packages/flask/app.py", line 1951, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/Users/morewater/pyenv/invoice/lib/python3.7/site-packages/flask_restful/init.py", line 269, in error_router
return original_handler(e)
File "/Users/morewater/pyenv/invoice/lib/python3.7/site-packages/flask/app.py", line 1820, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/Users/morewater/pyenv/invoice/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/Users/morewater/pyenv/invoice/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request
rv = self.dispatch_request()
File "/Users/morewater/pyenv/invoice/lib/python3.7/site-packages/flask/app.py", line 1935, in dispatch_request
return self.view_functionsrule.endpoint
File "/Users/morewater/Documents/workspace/eplating/invoice/backend/security/views/login.py", line 36, in login
**_ctx('login'))
File "/Users/morewater/pyenv/invoice/lib/python3.7/site-packages/flask_security/core.py", line 528, in render_template
return render_template(*args, **kwargs)
File "/Users/morewater/pyenv/invoice/lib/python3.7/site-packages/flask/templating.py", line 140, in render_template
ctx.app,
File "/Users/morewater/pyenv/invoice/lib/python3.7/site-packages/flask/templating.py", line 120, in _render
rv = template.render(context)
File "/Users/morewater/pyenv/invoice/lib/python3.7/site-packages/jinja2/asyncsupport.py", line 76, in render
return original_render(self, *args, **kwargs)
File "/Users/morewater/pyenv/invoice/lib/python3.7/site-packages/jinja2/environment.py", line 1008, in render
return self.environment.handle_exception(exc_info, True)
File "/Users/morewater/pyenv/invoice/lib/python3.7/site-packages/jinja2/environment.py", line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File "/Users/morewater/pyenv/invoice/lib/python3.7/site-packages/jinja2/_compat.py", line 37, in reraise
raise value.with_traceback(tb)
File "/Users/morewater/Documents/workspace/eplating/invoice/backend/security/views/templates/security/login_user.html", line 5, in top-level template code
{% include "security/_messages.html" %}
File "/Users/morewater/pyenv/invoice/lib/python3.7/site-packages/jinja2/environment.py", line 1005, in render
return concat(self.root_render_func(self.new_context(vars)))
File "/Users/morewater/Documents/workspace/eplating/invoice/backend/security/views/templates/security/login_user.html", line 30, in root

File "/Users/morewater/Documents/workspace/eplating/invoice/backend/admin/views/templates/admin/master.html", line 13, in root


File "/Users/morewater/pyenv/invoice/lib/python3.7/site-packages/jinja2/environment.py", line 830, in get_template
return self._load_template(name, self.make_globals(globals))
File "/Users/morewater/pyenv/invoice/lib/python3.7/site-packages/jinja2/environment.py", line 804, in _load_template
template = self.loader.load(self, name, globals)
File "/Users/morewater/pyenv/invoice/lib/python3.7/site-packages/jinja2/loaders.py", line 113, in load
source, filename, uptodate = self.get_source(environment, name)
File "/Users/morewater/pyenv/invoice/lib/python3.7/site-packages/flask/templating.py", line 60, in get_source
return self._get_source_fast(environment, template)
File "/Users/morewater/pyenv/invoice/lib/python3.7/site-packages/flask/templating.py", line 86, in _get_source_fast
return loader.get_source(environment, template)
File "/Users/morewater/pyenv/invoice/lib/python3.7/site-packages/jinja2/loaders.py", line 168, in get_source
pieces = split_template_path(template)
File "/Users/morewater/pyenv/invoice/lib/python3.7/site-packages/jinja2/loaders.py", line 27, in split_template_path
for piece in template.split('/'):
jinja2.exceptions.UndefinedError: 'admin_base_template' is undefined

Broken docker-compose.yml config

Im getting some error when I run docker-compose up on macOS.
I set FLASK_DEBUG=true in the docker-compose.yml under backend section and getting this:

sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) could not translate host name "postgres" to address: Name does not resolve

Tried adding hostname: postgres to postgres section with no luck. Any ideas how I can make it fly locally with Docker?

Anyone using this with gmail?

here is my mail config

    MAIL_ADMINS = ('[email protected]',)  # FIXME
    MAIL_SERVER = os.environ.get('FLASK_MAIL_HOST', 'smtp.gmail.com')
    MAIL_PORT = int(os.environ.get('FLASK_MAIL_PORT', 587))    # tls
    #MAIL_PORT = int(os.environ.get('FLASK_MAIL_PORT', 465))     # ssl
    MAIL_USE_TLS = get_boolean_env('FLASK_MAIL_USE_TLS', True)
    MAIL_USE_SSL = get_boolean_env('FLASK_MAIL_USE_SSL', False)
    MAIL_USERNAME = os.environ.get('FLASK_MAIL_USERNAME', '[email protected]')
    MAIL_PASSWORD = os.environ.get('FLASK_MAIL_PASSWORD', 'myapppass')
    MAIL_DEFAULT_SENDER = (
        os.environ.get('FLASK_MAIL_DEFAULT_SENDER_NAME', 'Flask React SPA'),
        os.environ.get('FLASK_MAIL_DEFAULT_SENDER_EMAIL',
                       f"noreply@{os.environ.get('FLASK_DOMAIN', 'localhost')}")
    )

I get an error Network Unreachable



[2019-11-12 17:30:57,990: INFO/MainProcess] Received task: backend.tasks.send_mail_async_task[ed6f60b9-4f23-45ec-b954-e5c5e76c1373]
[2019-11-12 17:30:57,991: DEBUG/MainProcess] TaskPool: Apply <function _fast_trace_task at 0x7f8b56b2bd08> (args:('backend.tasks.send_mail_async_task', 'ed6f60b9-4f23-45ec-b954-e5c5e76c1373', {'lang': 'py', 'task': 'backend.tasks.send_mail_async_task', 'id': 'ed6f60b9-4f23-45ec-b954-e5c5e76c1373', 'shadow': None, 'eta': None, 'expires': None, 'group': None, 'retries': 0, 'timelimit': [None, None], 'root_id': 'ed6f60b9-4f23-45ec-b954-e5c5e76c1373', 'parent_id': None, 'argsrepr': '(<flask_mail.Message object at 0x7f9ba724d5c0>,)', 'kwargsrepr': '{}', 'origin': 'gen13146@frickyou', 'reply_to': '7e5f5826-1177-36ef-8d89-feebe795adad', 'correlation_id': 'ed6f60b9-4f23-45ec-b954-e5c5e76c1373', 'delivery_info': {'exchange': '', 'routing_key': 'celery', 'priority': 0, 'redelivered': None}}, b'\x80\x02cflask_mail\nMessage\nq\x00)\x81q\x01}q\x02(X\n\x00\x00\x00recipientsq\x03]q\x04X\x1a\x00\x00\[email protected]\x05aX\x07\x00\x00\x00subjectq\x06X\x07\x00\x00\x00Welcomeq\x07X\x06\x00\x00\x00senderq\x08X\x0f\x00\x00\x00Flask React... kwargs:{})
[2019-11-12 17:30:57,993: DEBUG/MainProcess] Task accepted: backend.tasks.send_mail_async_task[ed6f60b9-4f23-45ec-b954-e5c5e76c1373] pid:10190
[2019-11-12 17:33:09,138: ERROR/ForkPoolWorker-4] Task backend.tasks.send_mail_async_task[ed6f60b9-4f23-45ec-b954-e5c5e76c1373] raised unexpected: OSError(101, 'Network is unreachable')
Traceback (most recent call last):
  File "/home/lou/lou/flask-react-spa/FRSpa/lib/python3.6/site-packages/celery/app/trace.py", line 382, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/home/lou/lou/flask-react-spa/backend/extensions/celery.py", line 25, in __call__
    return BaseTask.__call__(self, *args, **kwargs)
  File "/home/lou/lou/flask-react-spa/FRSpa/lib/python3.6/site-packages/celery/app/trace.py", line 641, in __protected_call__
    return self.run(*args, **kwargs)
  File "/home/lou/lou/flask-react-spa/backend/tasks.py", line 17, in send_mail_async_task
    mail.send(msg)
  File "/home/lou/lou/flask-react-spa/FRSpa/lib/python3.6/site-packages/flask_mail.py", line 491, in send
    with self.connect() as connection:
  File "/home/lou/lou/flask-react-spa/FRSpa/lib/python3.6/site-packages/flask_mail.py", line 144, in __enter__
    self.host = self.configure_host()
  File "/home/lou/lou/flask-react-spa/FRSpa/lib/python3.6/site-packages/flask_mail.py", line 156, in configure_host
    host = smtplib.SMTP_SSL(self.mail.server, self.mail.port)
  File "/usr/lib/python3.6/smtplib.py", line 1031, in __init__
    source_address)
  File "/usr/lib/python3.6/smtplib.py", line 251, in __init__
    (code, msg) = self.connect(host, port)
  File "/usr/lib/python3.6/smtplib.py", line 336, in connect
    self.sock = self._get_socket(host, port, self.timeout)
  File "/usr/lib/python3.6/smtplib.py", line 1037, in _get_socket
    self.source_address)
  File "/usr/lib/python3.6/socket.py", line 724, in create_connection
    raise err
  File "/usr/lib/python3.6/socket.py", line 713, in create_connection
    sock.connect(sa)
OSError: [Errno 101] Network is unreachable

I tested connectivity and I can open the socket remotely

(FRSpa) lou@frickyou:~/lou/flask-react-spa$ telnet smtp.gmail.com 465
Trying 173.194.175.109...
Connected to smtp.gmail.com.
Escape character is '^]'.
^CConnection closed by foreign host.
(FRSpa) lou@frickyou:~/lou/flask-react-spa$
(FRSpa) lou@frickyou:~/lou/flask-react-spa$ telnet smtp.gmail.com 587
Trying 173.194.175.109...
Connected to smtp.gmail.com.
Escape character is '^]'.
220 smtp.gmail.com ESMTP t65sm16314qkh.99 - gsmtp
^C^]
telnet> quit
Connection closed.

Am I missing a config item somewhere?

Thanks!

Integratting with Swagger/OpenAPI

Has anyone had success integrating this with one Swagger/OpenAPI? I keep getting:

| File "/flask/venv/lib/python3.9/site-packages/flask_restful_swagger/swagger.py", line 329, in extract_operations
backend_1 | for method in [m.lower() for m in resource.methods]:
backend_1 | TypeError: 'NoneType' object is not iterable

When trying to bring this up with the normal pattern. Any tips or success with this? Mk...

how to host docs on interface ip?

I am a noob :) how do i host the docs on the interface IP rather than local IP?

I tried setting export SPHINX_DOCS_HOST=172.16.0.9 but no dice.

Thanks!

Celery Error

Getting this error both via docker install and local install (Ubuntu 18.04):

celery_worker_1 | [2018-08-18 19:53:28,411: INFO/MainProcess] Received task: backend.tasks.send_mail_async_task[836cae7a-f34c-420e-adf0-d4c569891732]
celery_worker_1 | [2018-08-18 19:53:28,426: ERROR/ForkPoolWorker-1] Task backend.tasks.send_mail_async_task[836cae7a-f34c-420e-adf0-d4c569891732] raised unexpected: AttributeError("'FlaskCelery' object has no attribute 'app'",)
celery_worker_1 | Traceback (most recent call last):
celery_worker_1 | File "/usr/local/lib/python3.6/site-packages/celery/app/trace.py", line 374, in trace_task
celery_worker_1 | R = retval = fun(*args, **kwargs)
celery_worker_1 | File "/flask/src/backend/extensions/celery.py", line 24, in call
celery_worker_1 | with _celery.app.app_context():
celery_worker_1 | AttributeError: 'FlaskCelery' object has no attribute 'app'

Ansible

Hi, I am having an issue running ansible playbook in both dev and deploy envs
dev env

TASK [flask : create virtualenv /virtualenvs/flask_api] ************************
fatal: [centos74.io]: FAILED! => {"changed": false, "cmd": "virtualenv -p /usr/bin/python3.6 /virtualenvs/flask_api", "msg": "[Errno 2] No such file or directory", "rc": 2}

deploy env

TASK [flask : create virtualenv /virtualenvs/flask_api] ************************************************************************************************************
fatal: [centos74.io]: FAILED! => {"changed": false, "cmd": "virtualenv -p /usr/bin/python3.6 /virtualenvs/flask_api", "msg": "[Errno 2] No such file or directory", "rc": 2}

I found it is called on file flask-react-spa/ansible/roles/flask/tasks/install_virtualenv.yaml. So I tried editing without success. I assume it is considering /virtualenvs/flask_api as a path and it doesn't exist ?

cheers.
G.

Running this on ubuntu 18.04, using vm as presented in ansible/dev-scripts.

does the mail stuff work?

I put my information for the mail section in config.py but i do not get any confirmation emails. Is this section working?

    ##########################################################################
    # mail                                                                   #
    ##########################################################################
    MAIL_ADMINS = ('[email protected]',)  # FIXME
    MAIL_SERVER = os.environ.get('FLASK_MAIL_HOST', 'smtp.gmail.com')
    MAIL_PORT = int(os.environ.get('FLASK_MAIL_PORT', 587))
    MAIL_USE_TLS = get_boolean_env('FLASK_MAIL_USE_TLS', True)
    MAIL_USE_SSL = get_boolean_env('FLASK_MAIL_USE_SSL', False)
    MAIL_USERNAME = os.environ.get('FLASK_MAIL_USERNAME', '[email protected]')
    MAIL_PASSWORD = os.environ.get('FLASK_MAIL_PASSWORD', 'myapppassword')
    MAIL_DEFAULT_SENDER = (
        os.environ.get('FLASK_MAIL_DEFAULT_SENDER_NAME', 'Flask React SPA'),
        os.environ.get('FLASK_MAIL_DEFAULT_SENDER_EMAIL',
                       f"noreply@{os.environ.get('FLASK_DOMAIN', 'localhost')}")
    )

Question, disable csrf for specific endpoint

Do you have a tip, how to disable csrf for some views?
I try to implement this:
`
from flask_wtf import CSRFProtect
csrf = CSRFProtect()

@csrf.exempt

@api.route(git, '/string:project_name/git-receive-pack', methods=('POST',))

def git_receive_pack(project_name):
`

But decorator doesn't work for me.
Is the a parameter for the api.route?

Webpack frontend build failing with docker-compose up --build

Thanks for this comprehensive build stack with Flask. The frontend build seems to be failing for me on Ubuntu 18.04 with docker. Tried to use it with docker-compose and received the following error in the logs when building with docker-compose up --build:

> [email protected] build:dll /flask
> node frontend/internals/scripts/dependencies.js

Building the Webpack DLL...
module.js:529
throw err;
^

Error: Cannot find module '/flask/frontend/app/config'
at Function.Module._resolveFilename (module.js:527:15)
at Function.Module._load (module.js:476:23)
at Module.require (module.js:568:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/flask/frontend/internals/webpack/webpack.base.config.js:5:19)
at Module._compile (module.js:624:30)
at Object.Module._extensions..js (module.js:635:10)
at Module.load (module.js:545:32)
at tryModuleLoad (module.js:508:12)
at Function.Module._load (module.js:500:3)
npm info lifecycle [email protected]~postbuild:dll: [email protected]
npm info ok 

uWSGI redis connection refused

Hi Brian,
I had some 500 internal server errors when deploying, especially with loading articles.

Turns out, the uwsgi processes were not connecting with redis.
So I swapped in geerlingguys role for redis instead of sbaerlochers, which is archived since some time and this resolved my issue.
If you can confirm this behavior with your workflow, I can open a pull request, if you like.

Regards,
Dan

PS: the latest fixes for import-articles should also be adjusted in the docker entrypoint scripts.
:)

docker-compose up --build fails with permision errors

Actually throwing all kind of errors any help would be greatly appreciated the project looks awesome!

Errors

Attaching to flask-react-spa_redis_1, flask-react-spa_celery_beat_1, flask-react-spa_sphinx_docs_1, flask-react-spa_mailhog_1, flask-react-spa_postgres_1, flask-react-spa_celery_worker_1, flask-react-spa_backend_1, flask-react-spa_frontend_1
redis_1 | find: .: Permission denied
redis_1 | chown: .: Permission denied
celery_beat_1 | Traceback (most recent call last):
celery_beat_1 | File "/usr/local/bin/celery", line 11, in
celery_beat_1 | sys.exit(main())
celery_beat_1 | File "/usr/local/lib/python3.6/site-packages/celery/main.py", line 16, in main
celery_beat_1 | _main()
celery_beat_1 | File "/usr/local/lib/python3.6/site-packages/celery/bin/celery.py", line 322, in main
celery_beat_1 | cmd.execute_from_commandline(argv)
celery_beat_1 | File "/usr/local/lib/python3.6/site-packages/celery/bin/celery.py", line 496, in execute_from_commandline
celery_beat_1 | super(CeleryCommand, self).execute_from_commandline(argv)))
celery_beat_1 | File "/usr/local/lib/python3.6/site-packages/celery/bin/base.py", line 273, in execute_from_commandline
celery_beat_1 | argv = self.setup_app_from_commandline(argv)
celery_beat_1 | File "/usr/local/lib/python3.6/site-packages/celery/bin/base.py", line 479, in setup_app_from_commandline
celery_beat_1 | self.app = self.find_app(app)
celery_beat_1 | File "/usr/local/lib/python3.6/site-packages/celery/bin/base.py", line 501, in find_app
celery_beat_1 | return find_app(app, symbol_by_name=self.symbol_by_name)
celery_beat_1 | File "/usr/local/lib/python3.6/site-packages/celery/app/utils.py", line 359, in find_app
celery_beat_1 | sym = symbol_by_name(app, imp=imp)
celery_beat_1 | File "/usr/local/lib/python3.6/site-packages/celery/bin/base.py", line 504, in symbol_by_name
celery_beat_1 | return imports.symbol_by_name(name, imp=imp)
celery_beat_1 | File "/usr/local/lib/python3.6/site-packages/kombu/utils/imports.py", line 56, in symbol_by_name
celery_beat_1 | module = imp(module_name, package=package, **kwargs)
celery_beat_1 | File "/usr/local/lib/python3.6/site-packages/celery/utils/imports.py", line 104, in import_from_cwd
celery_beat_1 | return imp(module, package=package)
celery_beat_1 | File "/usr/local/lib/python3.6/importlib/init.py", line 126, in import_module
celery_beat_1 | return _bootstrap._gcd_import(name[level:], package, level)
celery_beat_1 | File "", line 994, in _gcd_import
celery_beat_1 | File "", line 971, in _find_and_load
celery_beat_1 | File "", line 953, in _find_and_load_unlocked
celery_beat_1 | ModuleNotFoundError: No module named 'wsgi'
flask-react-spa_redis_1 exited with code 1
flask-react-spa_celery_beat_1 exited with code 1
...
...
frontend_1 | WARNING: config.js not found, using default
frontend_1 | cp: can't stat 'frontend/app/config.js': Permission denied
frontend_1 | npm info it worked if it ends with ok
frontend_1 | npm info using [email protected]
frontend_1 | npm info using [email protected]
frontend_1 | npm info lifecycle [email protected]prebuild:dll: [email protected]
frontend_1 | npm info lifecycle [email protected]
build:dll: [email protected]
frontend_1 |
frontend_1 | > [email protected] build:dll /flask
frontend_1 | > node frontend/internals/scripts/dependencies.js
frontend_1 |
frontend_1 | module.js:473
frontend_1 | throw err;
frontend_1 | ^
frontend_1 |
frontend_1 | Error: Cannot find module '/flask/frontend/internals/scripts/dependencies.js'
frontend_1 | at Function.Module._resolveFilename (module.js:527:15)
frontend_1 | at Function.Module._load (module.js:453:25)
frontend_1 | at Function.Module.runMain (module.js:665:10)
frontend_1 | at startup (bootstrap_node.js:187:16)
frontend_1 | at bootstrap_node.js:607:3
frontend_1 | npm info lifecycle [email protected]build:dll: Failed to exec build:dll script
frontend_1 | npm ERR! code ELIFECYCLE
frontend_1 | npm ERR! errno 1
frontend_1 | npm ERR! [email protected] build:dll: node frontend/internals/scripts/dependencies.js
frontend_1 | npm ERR! Exit status 1
frontend_1 | npm ERR!
frontend_1 | npm ERR! Failed at the [email protected] build:dll script.
frontend_1 | npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
frontend_1 |
frontend_1 | npm ERR! A complete log of this run can be found in:
frontend_1 | npm ERR! /root/.npm/_logs/2019-05-13T17_11_53_370Z-debug.log
frontend_1 | npm info it worked if it ends with ok
frontend_1 | npm info using [email protected]
frontend_1 | npm info using [email protected]
frontend_1 | npm info lifecycle [email protected]
prestart: [email protected]
frontend_1 | npm info lifecycle [email protected]start: [email protected]
frontend_1 |
frontend_1 | > [email protected] start /flask
frontend_1 | > node frontend/server
frontend_1 |
backend_1 | python3: can't open file 'manage.py': [Errno 13] Permission denied
backend_1 | Waiting for postgres ready...
frontend_1 | module.js:473
frontend_1 | throw err;
frontend_1 | ^
frontend_1 |
frontend_1 | Error: Cannot find module '/flask/frontend/server'
frontend_1 | at Function.Module._resolveFilename (module.js:527:15)
frontend_1 | at Function.Module._load (module.js:453:25)
frontend_1 | at Function.Module.runMain (module.js:665:10)
frontend_1 | at startup (bootstrap_node.js:187:16)
frontend_1 | at bootstrap_node.js:607:3
frontend_1 | npm info lifecycle [email protected]
start: Failed to exec start script
frontend_1 | npm ERR! code ELIFECYCLE
frontend_1 | npm ERR! errno 1
frontend_1 | npm ERR! [email protected] start: node frontend/server
frontend_1 | npm ERR! Exit status 1
frontend_1 | npm ERR!
frontend_1 | npm ERR! Failed at the [email protected] start script.
frontend_1 | npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
frontend_1 |
frontend_1 | npm ERR! A complete log of this run can be found in:
frontend_1 | npm ERR! /root/.npm/_logs/2019-05-13T17_11_53_943Z-debug.log
flask-react-spa_frontend_1 exited with code 1
backend_1 | python3: can't open file 'manage.py': [Errno 13] Permission denied
backend_1 | Waiting for postgres ready...
backend_1 | python3: can't open file 'manage.py': [Errno 13] Permission denied
backend_1 | Waiting for postgres ready...
backend_1 | python3: can't open file 'manage.py': [Errno 13] Permission denied
backend_1 | Waiting for postgres ready...
backend_1 | python3: can't open file 'manage.py': [Errno 13] Permission denied
backend_1 | Waiting for postgres ready...
backend_1 | python3: can't open file 'manage.py': [Errno 13] Permission denied
backend_1 | Waiting for postgres ready...
backend_1 | python3: can't open file 'manage.py': [Errno 13] Permission denied
backend_1 | Waiting for postgres ready...
backend_1 | python3: can't open file 'manage.py': [Errno 13] Permission denied
backend_1 | Waiting for postgres ready...
backend_1 | python3: can't open file 'manage.py': [Errno 13] Permission denied
backend_1 | Waiting for postgres ready...
backend_1 | python3: can't open file 'manage.py': [Errno 13] Permission denied
backend_1 | Waiting for postgres ready...
backend_1 | python3: can't open file 'manage.py': [Errno 13] Permission denied
backend_1 | Waiting for postgres ready...

infinite loop or so it seems

Got Anything?

BTW
System Info
Fedora30
kernel
5.0.13-300.fc30.x86_64

Thanks

CORS Policy

I have issue adding CORS policy on the app. Can't successfully get REST API on REACT

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.