Giter Site home page Giter Site logo

lumenwrites / django-react-blog Goto Github PK

View Code? Open in Web Editor NEW
561.0 561.0 94.0 12.45 MB

Simple blog built with Django and React/Redux, deployed with Docker, and served with nginx/uwsgi.

Home Page: http://digitalmind.io

License: MIT License

Python 14.77% HTML 0.27% JavaScript 63.36% CSS 21.50% Shell 0.10%
bootstrap django django-rest-framework docker react redux

django-react-blog's People

Contributors

alephmelo avatar lumenwrites 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  avatar  avatar

django-react-blog's Issues

Use development/production NODE_ENV

I get this warning on digitalmind.io (both Chrome and FF):

magpie_20170314_155423

There are probably two problems:

  • the live site runs with development build, not production one (webpack -p)
  • as the warning says, the code shouldn't be minified when running in development mode

I use something like this to minify code only in production builds:

function getPlugins() {
    const plugins = [];

    if (process.env.NODE_ENV === "production") {
        plugins.push(new webpack.optimize.UglifyJsPlugin({
            minimize: true,
            output: {
                comments: false
            },
            compressor: {
                warnings: false
            }
        }));
    } else {
        // not related to this issue,
        // but quite useful, too :)
        plugins.push(new webpack.HotModuleReplacementPlugin());
    }

    return plugins;
}

module.exports = {
    
    plugins: getPlugins(),}

Getting error when running migrations for the first time

Running migrations:
  Rendering model states... DONE
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying authtoken.0001_initial... OK
  Applying authtoken.0002_auto_20160226_1747... OK
  Applying categories.0001_initial... OK
  Applying categories.0002_auto_20170215_2244... OK
  Applying categories.0003_category_description... OK
  Applying posts.0001_initial... OK
  Applying posts.0002_auto_20170301_1328... OK
  Applying posts.0003_auto_20170303_2103... OK
  Applying posts.0004_auto_20170307_0252...Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.5/dist-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.5/dist-packages/django/core/management/__init__.py", line 359, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.5/dist-packages/django/core/management/base.py", line 305, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.5/dist-packages/django/core/management/base.py", line 356, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python3.5/dist-packages/django/core/management/commands/migrate.py", line 202, in handle
    targets, plan, fake=fake, fake_initial=fake_initial
  File "/usr/local/lib/python3.5/dist-packages/django/db/migrations/executor.py", line 97, in migrate
    state = self._migrate_all_forwards(plan, full_plan, fake=fake, fake_initial=fake_initial)
  File "/usr/local/lib/python3.5/dist-packages/django/db/migrations/executor.py", line 132, in _migrate_all_forwards
    state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
  File "/usr/local/lib/python3.5/dist-packages/django/db/migrations/executor.py", line 237, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/usr/local/lib/python3.5/dist-packages/django/db/migrations/migration.py", line 129, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "/usr/local/lib/python3.5/dist-packages/django/db/migrations/operations/fields.py", line 204, in database_forwards
    schema_editor.alter_field(from_model, from_field, to_field)
  File "/usr/local/lib/python3.5/dist-packages/django/db/backends/base/schema.py", line 480, in alter_field
    return self._alter_many_to_many(model, old_field, new_field, strict)
  File "/usr/local/lib/python3.5/dist-packages/django/db/backends/base/schema.py", line 798, in _alter_many_to_many
    new_field.remote_field.through._meta.get_field(new_field.m2m_reverse_field_name()),
AttributeError: 'ManyToManyField' object has no attribute 'm2m_reverse_field_name'
root@8aa34cbd794a:/home/blog/backend# python3.5 manage.py createsuperuser
System check identified some issues:

WARNINGS:
posts.Post.tags: (fields.W340) null has no effect on ManyToManyField.

Login shows Bad Login Info

I've followed all the steps mentioned in readme
docker-compose up
docker exec -i -t backend /bin/bash
python3.5 manage.py migrate
python3.5 manage.py createsuperuser (create root user)

But when I goto localhost/login and login, the webpage show "Bad Login Info"

Page number

I am looking for a Django blog bootstrap, and I was messing with the online website.

I noticed that the page number changes, but the context inside the page number is not changing.
For example, if page 1 was showing context "x", page 2 is also showing context "x" instead of having another context , such as "y".

I hope this helps.

Docker configuration

Hello, thank you for sharing this project, I'll take a deep look at it since its the kind of setup I'd like to use for my projects.

Some questions/suggestions if I may (please correct me if I'm wrong, I'm still kinda new to these technologies):

Wouldn't it be better to have a docker-compose.yml file for production and one for development?
these are the things I would change in the production config:

  • You are exposing the frontend and backend containers to be accessible from the outside, at http://digitalmind.io:8000/ and http://digitalmind.io:8080/. That may be good for testing but once you have that up and running, you can made them only accesible by the proxy container that sits on port 80. to do that, you can change the ports: 8000:8000 line in the docker compose config, to expose:8000 and so on.
  • I see that you commited the .env file with passwords to git, you are changing those credentials on the production version of your blog right?
  • why are you using a second nginx to serve the static frontend files instead of using the main one at port 80? would it be possible to have a build directory on the react app with the bundle and minified files and serve those static files with the main nginx?
  • you are mounting host volumes to the containers to share the code and make live changes to it. would it be better to not do this on the production config to avoid depending on the host storage and just copy the code to the container.
  • to get postgres persistent storage the recommended way to do this is using named volumes available from docker 1.9+ , like this
  • due to the union filesystem docker uses, each write layer you create when you install dependencies in a new RUN command, makes searches for files more inefficient. It's recommended that you install all your dependencies with a single RUN command, using bash && to chain commands

If you don't mind, I'll submit some issues if I have any further questions about the project, so I can learn a thing or two and hopefully contribute to this project.

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.