How to solve Django custom app unsolved reference error but code working? - django-models

I use PyCharm 2022.3.2 CE and Python 3.11.1
I get a Django application that is underline in red (unsolved reference) so I can't use code completion but the code is working. I guess this is a bug from PyCharm but I can't figure it out to get code completion.
Project structure
I try to import model from listings.models to listings.views
Any help would be much appreciated !
Thank you
Try to import Django app to get code completion

Related

Getting ImportError: cannot import name 'db' from 'flask_sqlalchemy when using github tutorial

I'm really stuck on this. I try to make website form using Flask ant SQLAlchemy using this tutorial:
https://github.com/techwithtim/Flask-Web-App-Tutorial/tree/main/website and getting this error.
First, I thought that there is some typo I have made, but I try to copy all the code and getting the same error. What could cause this error? Some configuration settings maybe? Or this tutorial is with mistake?
Folders and files tree is the same as in github example.

The Angular Universal (SSR) cannot integrate with the external libraries like puppeteer, bulljs

This is just for describing the issue and sharing my solution, I got stuck a lot of time on it.
This issue happened after I upgraded the Angular 10 -> 11 and changed the builder from udk:udk-runner to #angular-devkit
The issue I was facing is when I set the field bundleDependencies in angular.json to true . The Puppeteer cannot start with the error cannot launch the browser
Then I found it also happened on the other external libraries I'm using at the Server side like BullJS Bull-Board Puppeteer-Cluster with the below error
Github source for demo the issue: https://github.com/phattranky/angular-ssr-error-with-pupepteer
The solution is quite simple you just need to add externalDependencies below the field bundleDependencies, which are the libraries we are using.
"externalDependencies": ["puppeteer", "puppeteer-cluster", "bull", "bull-board"]
Sample:
What is the externalDependencies ?
https://github.com/angular/angular-cli/blob/master/packages/angular_devkit/build_angular/src/builders/server/schema.json
If you have the better solution and any feedbacks, please share for me. Thanks

React app throwing errors when using 'react-pdf'

I've been having trouble getting react-pdf to work properly in my react app that I created using 'create-react-app'. From various github comments on the react-pdf page, it seems that there's an issue setting up the workerSrc in React applications that were created with 'create-react-app'.
One work around that seemed to solve the issue (temporarily) was to copy the pdf.worker.js file from the node-modules/build/pdfjs-dist/build folder and place it in the public folder of my react app. Then in my index.js file put the following code:
import {pdfjs} from 'react-pdf'
window.PDFJS.workerSrc = process.env.PUBLIC_URL + '/pdf.worker.js'
This worked just fine for a week, until I installed a new module into my application with npm. Now, I'm getting the same error I did in the beginning, and nothing has changed:
index.js:14 Uncaught TypeError: Cannot set property 'workerSrc' of undefined
These were the initial comments that helped me narrow down the error:
https://github.com/facebook/create-react-app/issues/1574#issuecomment-280436498
https://github.com/wojtekmaj/react-pdf/issues/291
but now that it's back I'm kind of at a loss for ideas. Has anyone else experienced this and been able to solve it? Any help would be greatly appreciated!
Based on what I have seen in the docs and in forums, it appears you should be altering the global PDFJS object.
PDFJS.workerSrc, instead of window.workerSrc.
I managed to get this working by loading the worker from CDN.
import { Document, Page, pdfjs } from 'react-pdf';
pdfjs.GlobalWorkerOptions.workerSrc=//cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.js

First qpython jnius example not working?

I am trying to test pyjnius in the qpython console on Android.
My first line:
from jnius import autoclass
fails in console with SystemError: NULL result without error in PyObject_Call
Any suggestions or am I missing something?
(I tested this on two devices with a fresh qpython install.)
Maybe you found a solution, but I had a similar experience with QPython and Plyer the otherday. Seems you can not (yet) use Plyer or Pyjnius in the console with QPython. Running the script as a Kivy app makes imports of Plyer or Pyjnius work. Try adding the following lines:
#-*-coding:utf8;-*-
#qpy:2
#qpy:kivy
on top of your script

sublime text 3 js code completion not working after installing angularJS

I just installed angularJS package control after following the link http://weblogs.asp.net/dwahlin/using-the-angularjs-package-for-sublime-text, this enabled me to get the angular code hints but it messed up my default code hinting feature in sublime-text 3. In the attached image, I have this function decrementCountdown defined, when I try to use it - it does not show up in the code completion hints, the only things I see is the AngularJS methods.
Could someone please help me? thanks
Try disabling AngularJS javascript Autocompletion
as can be seen in the issue on their Github Page.
Sublime 3 javascript Autocompletion not working properly

Resources