I'm using Pycharm to write a Django App with React as the frontend. Because the React source code is inside the Django source code, there is no clear way to trans-compile the React source code.
I know Pycharm can compile the code if it is a React project, but there are no instructions for compiling if it is embedded in a Django project.
I don't have a list of things I've tried because I have no idea where to start other than doing searches on Google, which I've already done.
I did look at the file-watcher in Pycharm, but it is not clear if this is a solution because there is nothing React related in it.
I think the proper way to go about this is to have two different projects, one for Django and one for React; you can then attach them later in one window, if you want (just open one, then the other - you will be prompted about what to do with the second).
Related
I have a problem with developing a Django website. I started out with using CDN Boostrap and JS as recommended in Boostrap 5 docs but then I wanted to customize the CSS, so I changed the setup to compile Bootstrap's source scss files with django-libsass. I followed the installation guides for django-libsass and django-compressor.
What I discovered is that while everything works, it works very slow on my local machine (5-6s per opening a new page). I'm not very experienced in web development so I'm not sure what could be causing this.
If it's relevant, I don't use a frontend yet and I'm sticking to Django's templates.
I tried to download a sample django libsass project and put bootstrap there and the outcome was the same.
I expected the time for loading the pages to increase slightly due to the fact that now it has to compile scss files but not so much.
Googling turned up no results:(
Is this an expected behavior when debugging from a local machine or am I missing something? Huge thanks!
Firstly , i would like to say that this package is amazing in the sense where there can be so much flexibility. Im relatively new to this package and im just trying to figure a way to fiddle around with the provided front end in the river-admin package. Could someone point me in the correct direction in doing so?
I am the author of both django-river and river-admin.
river-admin is an admin interface for django-river implemented as a Vue.js application backed by django-rest-framework.
One fact about it is that it was never meant to use the river-admin as an extension to your django app which means that it doesn't have to fit in how your own django app looks. You might think of it is like the UI of Apache Airflow or RabbitMQ admin interface and so on.
But if you think that the things you wanna add are something that can be used by all of its other users why not contribute to the repo. Otherwise, you can always fork the repo and do the custom changes that you can not do via the river-admin API, build the package by yourself.
Here is some information on how one can build and run stuff locally
I've built out a basic django application, and I'm looking to incorporate react+redux into the app. I've come across several react+redux templates like the react-redux-starter-kit and redux-webpack-es6-boilerplate:
These are awesome, except they both run node servers. I'm wondering:
Does there exist some sort of a tutorial or template that has the same features (webpack, Hot Module Replacement, linting, testing, abides by Fractal Project Structure guidelines, etc...) but does not run a node server, so I can just copy it into my django application (I realize I'd have to do a fair bit of configuration to get everything working smoothly).
Is it ok to run the webpack server within my django application? (Basically node would be running within django) Are there any downsides in doing this?
I've tried altering the above two templates, but they are pretty dense and complicated. Any advice would be very much appreciated!
I don't see any reason to mixing up django and react app.
I would prever leave them as two independent parts of your application: SPA (react + redux) + API (django)
If you already have django app and just need to add some react pages into, then build react app as static files and place it outside your django project, and configure your reverse proxy server (nginx) to load those new pages as static pages (react).
I know it sounds like a dumb question and I myself felt terribly bad when I faced this unforgivable lack of knowledge about a framework that I use basically every day...but so it is!
I had the necessity of forking a django package to add some fields to some of its models. Everything fine, I forked the project on github, cloned locally and then realized that: any django package does not include a common django setup so how am I supposed to run the migrations I need in order to complete my changes and push back to the repo the new version of the app?
I thought of course of starting another django project and cloning the fork as an app but doesn't that feel a bit over the top for a process like this? What would be the correct way of doing this?
Your app ships without any project environment, but in development you need a project environment. Be it for making migrations, running tests, running the server or running checks.
Creating a django project is the way to go. Unless you decide to write migrations yourself and discard tests.
I guess django apps repositories to not provide a django project environment because it's up to the developer to configure it.
I would like to integrate an existing application someone has on github into my site. What steps do I need to take to integrate it?
Would most people just download this entire thing and throw it inside of the project root, add it to the INSTALLED_APPS and modify urls.py? I would imagine there are some extra steps I'd have to take to get it to work.
In addition, since it was written in Jan 09-esque, and I'm using the latest 1.2 release I would probably have to modify and add some form csrf checking?
There are no generic instructions for integrating existing application into your django project because every application is different.
Generally most of the popular apps provide README/INSTALL docs which guides you through installation and How to use app. An app without documentation & tests is risky to use unless you are ready to own it and take pain of going through source code and figuring it out.
Also I don't think the application you posted above can be integrated into your project without modifying the code. It's a project by itself and can be used in standalone mode. (Well that's what I think after looking at source code)