Metadata-Version: 2.1
Name: django-create-react-app
Version: 0.8.3
Summary: use create react app with django
Home-page: https://github.com/aamirbhat/django-create-react-app.git
Author: Aamir Bhat
Author-email: aamirbhat.pro@gmail.com
License: UNKNOWN
Description: django-create-react-app
        ----------------------
        This app helps us to integrate the react in django project through create react app template. This app works both in dev and production mode of the react. 
        
        
        
        Quick start
        -----------
        
        ### Install 
        
        ```
        pip install django-create-react-app
        
        ```
        
        
        
        Add "create_react_app" to your INSTALLED_APPS setting like this::
        
        ```
            INSTALLED_APPS = [
                ...
                'create_react_app',
            ]
        
        ```
        
        ---
        
        # Settings Configuration
        
        ### Add Build Directory in the Settings
        
        ```
        yarn build or npm run build
        
        ```
        This creates the build directory inside the react folder. Add this build directory in the django settings e.g
        
        ```
        
        REACT_BUILD_DIRECTORY = os.path.join(BASE_DIR, 'app', 'react', 'build')
        
        ```
        
        
        ### Add create react app configuration into your settings::
        
        
        
        ```
            CREATE_REACT_APP = {
                'DEFAULT': {
                    'BUNDLE_DIR_NAME': REACT_BUILD_DIRECTORY,  
                    'FRONT_END_SERVER': "http://localhost:3000/",
                    'is_dev': False,
                }
            }
        ```
        
        
        ### Use it in your templates ::
        ```
        {% load react_bundle_loader %}
        
        <html>
          <head>
            {% render_bundle_css  %}
          </head>
          <body>
            ....
             {% render_bundle_js %}
          </body>
        </head>
            
        ```
        
        ### Add Below code for Collectstatic Finder to find the build folder ::
        ```
        STATICFILES_DIRS = (
            os.path.join(REACT_BUILD_DIRECTORY, 'static'),
        )
        ```
        
        
        
        
        
        #Adding Multiple React Apps inside django Project
        
        ```
        
        CREATE_REACT_APP = {
            'DEFAULT': {
                'BUNDLE_DIR_NAME': CLIENT_FRONTEND_BUILD,
                'FRONT_END_SERVER': "http://localhost:3000/",
                'is_dev':  True,
            },
            'ADMIN': {
                'BUNDLE_DIR_NAME': ADMIN_FRONTEND_BUILD,
                'FRONT_END_SERVER': "http://localhost:3001/",
                'is_dev': True,
            },
        }
        
        
        ```
        
        ### Rendering react admin app inside templates :: 
        ```
        {% load react_bundle_loader %}
        
        <html>
          <head>
            {% render_bundle_css "ADMIN" %}
          </head>
          <body>
            <div id="root"></div>
             {% render_bundle_js "ADMIN" %}
          </body>
        </head>
            
        ```
        
Keywords: django,create-react-app,react,django react,django integration  react, create react app
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Framework :: Django
Classifier: Environment :: Web Environment
Classifier: License :: OSI Approved :: MIT License
Description-Content-Type: text/markdown
