pycharm does not accept html file - html

I use the Django authentication system, and for this I created a template, named this file login.html and in the registration directory. I already had a file with this name (login.html), and then I created this file and deleted the previous file, now pycharm does not accept the new file as html, and because of this I can not put Django template in this file and Leave a link.
And you know you can't rename the file, because then the Django template authentication system can't find it. And now I do not know what to do.
What can I do to make pycharm accept this as html?

Make sure login.html has HTML file type and not e.g. Text one in Settings | Editor | File Types.

You Can simply rename this html file from login.html for example to login_users.html

Related

Why is my PHP file class recognized as text file?

I'm working on a Laravel project and when I was creating a new file I miss spelled the php extension ("php") but I didn't notice until I clicked enter so my PHP class files now appear as text files in PhpStorm and appears no hints whenever I write something in any php file.
Im using PhpStorm 2020.2.
Settings (Preferences on macOS) | Editor | File Types
Locate "PHP" entry in the top list (Recognized File Types)
Ensure that the middle list (File Name Patterns) has *.php entry there.
If it's not there then add it. Looks like you somehow re-assigned it to the "Text" file type.
Altought blade.php get recognized right,
That's because *.blade.php is assigned to separate/dedicated "Blade" file type (so IDE can provide Blade-specific support there).
And if you already did as #LazyOne suggested and your file still showing as text then right click the file and do this:

How to open .tmpl file same as html file in GoLand or PyCharm IDE?

I'm using GoLand IDE. When I open an HTML file I could see different colors in the file content, but when I open a .tmpl file which is used in Go-Template file, I couldn't check it like an HTML file, but when I change its postfix to .html instead of .tmpl it occurs.
So, how can I open .tmpl (Go-Template) file same as an HTML file in GoLand IDE?
Also, I tried with PyCharm IDE but the result was the same.
You can add *.tmpl to the list of patterns registered for HTML file type in Settings | Editor | File Types

How to save a created html file to a specific location by giving a path

I have created a html file of my results using .to_html() function.By default the html file saves to the root location of your project folder.But what if i want to save it to the specific location?How to give a path to the created folder .Im using flask to connect python to html.
You can access the root path of the flask through app.root_path.
So let's say your folder name is myHtmlFiles. So we can save the files like below:
file.save(os.path.join(app.root_path, "myHtmlFiles", "hey.html"))
You can also take a look at app.config, you can put your folder path here and use it anywhere in the aplplication.

Create hidden file template in PhpStorm

What is the best approach to creating a PhpStorm file template for a hidden file that pre-populates the file name (.htaccess) and does not include an extension?
The workflow currently is as follows:
Create file from template
Type in .editorconfig filename and hit 'ok'. Generated filename is .editorconfig..
Rename .editorconfig. to .editorconfig.
Is it possible to optimize this workflow to:
Create file from template
'editorconfig' filename prepopulated; simply hit 'ok'
AFAIK you cannot create File Template using File & Code Templates functionality for extensionless files (e.g. .editorconfig or .haccess) using standard GUI as it requires file extension part.
Few options:
1. Write custom plugin that would offer such functionality -- that's what .ignore plugin does.
2. Create File Template using .editorconfig extension (IDE will ask what File Type to use to associate *.editorfocnfig files with; I would choose "Ini").
Then create new file File | New | Your New FileTemplate and give it some name (e.g. a) -- in the end you will have a.editorconfig file.
Now just rename it to .editorconfig only.
You seem to be doing already that (slightly different version of it).
3. Do not use any File Templates. Just create brand new empty file (File | New | File) -- here you have to specify full file name including extension .. so .editorconfig can be entered here.
Once done -- just use Live Template functionality and quickly paste needed content.
You just need to create such Live Template in advance and give it some easy to use and remember abbreviation (if you wish to enter such text by typing abbreviation[TAB] (e.g. ec[TAB] where [TAB] is the expand key).
Live Templates official manual/how-to: https://confluence.jetbrains.com/display/PhpStorm/Live+Templates+%28Snippets%29+in+PhpStorm
Official Help pages: https://www.jetbrains.com/help/phpstorm/2016.3/live-templates.html?search=live%20template

PHPStorm: Generate filename on custom file template

PHP Storm: File templates
I would like to add custom file template with generated filename. I do not want to prompt filename by hand, I want it generated with variable values.
E.g. ${YEAR}${MONTH}${DAY}_${MyCustomVar}.sql
It there a way to do that?
Would you like to create files with 'fixed' names generated using temploate variables? It's not currently possible - you can file a request for this feature to youtrack (http://youtrack.jetbrains.com/issues/IDEA)
Related ticket: http://youtrack.jetbrains.com/issue/IDEABKL-6428