How to tackle redirect to an external url in NextJS?

The latest version of Next.js has this built in using the next.config.js script (see https://nextjs.org/docs/api-reference/next.config.js/redirects). No need for additional plugins. To test, copy the NextJs sample app: npx create-next-app nextjs-blog –use-npm –example “https://github.com/vercel/next-learn-starter/tree/master/learn-starter” Add a next.config.js file to the root folder with the following code: // this simply tests the redirecting of the root path … Read more

Python – how do I call external python programs?

If you want to call each as a Python script, you can do import subprocess subprocess.call([“python”, “myscript.py”]) subprocess.call([“python”, “myscript2.py”]) But a better way is to call functions you’ve written in other scripts, like this: import myscript import myscript2 myscript.function_from_script1() myscript2.function_from_script2() Where function_from_script1() etc are defined in the myscript.py and myscript2.py files. See this page on … Read more

Python: Create Dictionary from Text/File that’s in Dictionary Format

You can use the eval built-in. For example, this would work if each dictionary entry is on a different line: dicts_from_file = [] with open(‘myfile.txt’,’r’) as inf: for line in inf: dicts_from_file.append(eval(line)) # dicts_from_file now contains the dictionaries created from the text file Alternatively, if the file is just one big dictionary (even on multiple … Read more

Externalizing Grails Datasource configuration

You can use a properties file specified in the grails.config.locations as a way to externalize the datasource configuration. Below is how I typically set up a Grails project: In my DataSource.groovy I specify this for the production environment: …. …. production { dataSource { dbCreate = “update” driverClassName = “com.myorg.jdbcDriverNotExists” url = “” username = … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)