I'm learning flask web app.
I find a flask extension called Flask-SuperAdmin from github https://github.com/SyrusAkbary/Flask-SuperAdmin
I've already fork it, but I don't know how to run Flask-SuperAdmin example at local host.
Thanks!
You don't need to fork it to run it; you fork it if you want to make changes to it or to fix a bug in it.
To install it, use the standard Python installation tools:
pip install Flask-SuperAdmin
Then, read the quickstart section of the documentation to help you get started.
Related
I'm using the command func azure functionapp publish to publish my python function app to Azure. As best I can tell, the command only packages up the source code and transfers it to Azure, then on a remote machine in Azure, the function app is "built" and deployed. The build phase includes the collection of dependencies from pypi. Is there a way to override where it looks for these dependencies? I'd like to point it to my ow pypi server, or alternatively, provide the wheels locally in my source tree and have it use those. I have a few questions/problems:
Are my assumptions correct?
Assuming they are, is this possible, and how?
I've tried a few things, read some docs, looked at the various --help options in the CLI tool, I've set up a pip.conf file that I've verified works for local pip usage, then on purpose "broken it" and tried to see if the publish would fail (it did not, so this leads me to believe it ignores pip.conf, or the build (and collection of dependencies happens on the remote end). I'm at a loss and any tips, pointers, or answers are appreciated!
You can add additional pip source to point to your own pypi server. Check https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-python#remote-build-with-extra-index-url
Remote build with extra index URL:
When your packages are available from an accessible custom package index, use a remote build. Before publishing, make sure to create an app setting named PIP_EXTRA_INDEX_URL. The value for this setting is the URL of your custom package index. Using this setting tells the remote build to run pip install using the --extra-index-url option. To learn more, see the Python pip install documentation.
You can also use basic authentication credentials with your extra package index URLs. To learn more, see Basic authentication credentials in Python documentation.
And regarding referring local packages, that is also possible. Check https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-python#install-local-packages
I hope both of your questions are answered now.
I have created a python application containing rest apis which call machine learning code on PyCharm IDE. I want to deploy rest apis on IIS.
I copy and past complete PyCharm project in virtual directory. The issue I am facing is dependencies like tensorflow and keras are not being found due to which API is giving "Internal server error", however I am able to call rest services.
please guide.
As FishingCode suggested please share code snippet to understand the exact issue.
Please include and install requirements.txt file in virtual environment.
Also, you may try installing using docker tutorial
I have to install python package wfastcgi.py to get my web app run on individual server. IIS and Flask are working properly I guess. I tried a lot of ways and I have no idea. I want to start all over again with concrete instructions. Pip also doesn't work, I am using python through Anaconda3.
What I need to do to make wfastcgi work? By "working" I mean command "wfastcgi-enable" gives positive answer in cmd. Every tip is priceless.
Thanks a lot!
I'm trying to deploy a Flask web app with mysql connectivity. It's my first time using Azure, and coming off Linux it all seems pretty confusing.
My understanding is that one includes within the requirements.txt to include the packages required. When I build the default Flask app from Azure the file looks like this:
Flask<1
At this stage the site loads fine.
If I then include an additional line
https://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-2.1.14.tar.gz
As per this answer https://stackoverflow.com/a/34489738/2697874
Then in my views.py file (which seems to be broadly synonymous to my old app.py file) I include...import mysql.connector
I then restart and reload my site...which then returns the error The page cannot be displayed because an internal server error has occurred.
Error logging spits out a load of html (seems pretty weird way to deliver error logs - so I must be missing something here). When I save to html and load it up I get this...
How can I include the mysql.connector library within my Flask web app?
Per my experience, the resoure https://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-2.1.14.tar.gz is for Linux, not for Azure WebApps based on Windows, and the link seems to be not available now.
I used the command pip search mysql-connector to list the related package. Then, I tried to use mysql-connector instead of mysql-connector-python via pip install, and tried to import mysql.connector in local Python interpreter that works fine.
So please use mysql-connector==2.1.4 instead of mysql-connector-python== in the requirements.txt file of your project using IDE, then re-deploy the project on Azure and try again. The package will be installed automatically as the offical doc said as below.
Package Management
Packages listed in requirements.txt will be installed automatically in the virtual environment using pip. This happens on every deployment, but pip will skip installation if a package is already installed.
Any update, please feel free to let me know.
I am attempting to make a dynamic website for a school project. The problem is it has to be on the school server and I can't use any webframeworks. I have searched through google and stackoverflow but I can't seem to get an answer.
I have tried the code that was provided here:
How to implement a minimal server for AJAX in Python?
It worked on the local server but how can I change it so that it would open on the school server. When I used those codes, the page won't load or an internal error shows. Can someone point me in the right direction?
Using a web framework in python does not necessary needs a system package installation (like running a sudo apt-get install python-something).
In the end python frameworks are just files like in your project, but you can install them system wide (like in the apt-get example) or ship them within your project (probably what you want). Take a look at virtual environment for creating a self contained environment and setuptools foi packaging the application and its dependencies
For implementing an ajax server directly in python without a wsgi container (apache, nginx, etc) I recommend using flask. It is very, very simple and very powerful