Like finding which elements takes more time and dependencies ..
samedi 23 décembre 2017
Flask - 404 not found
I am a newbie in the flask development this is my first program in the flask but it shows me this error:
The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.
& this is my code
from flask import Flask
app = Flask(__name__)
@app.route('/index')
def index():
return 'Hello World'
if __name__ == '__main__':
app.run(debug=True)
Basic Payments API demo
I'm trying to get a basic Payments API demo to work. As far as I understand, a pop up should show, asking which credit card I would like to use, when I run this code:
<html>
<head>
</head>
<body>
<h1>Pay here</h1>
<script>
if(window.PaymentRequest){
alert("Payment request exists!");
const supportedPaymentMethods = [ {
supportedMethods: ["basic-card"]
}
];
const paymentDetails = {
total: {
label: "Total Cost",
amount: {
currency: "GBP",
value: 1
}
}
};
const options = {};
const paymentRequest = new PaymentRequest(
supportedMethods, paymentDetails, options
);
paymentRequest.show();
}
</script>
</body>
</html>
But not much happens. What does happen is that the alert message shows up. I'm just trying to get the basics working. I don't believe this code will send money to anyone because no account is mentioned. I hope to make the next step. Please help! Thanks.
Не видит зарегистрированного пользователя в сессии laravel
В контроллере LoginController Auth::attempt() работает корректно,пользователь аутентифицируется, но на других страницах фасад Auth::check() возвращает null, т.е. другие контроллеры не видят пользователя. Попробовал менять что-то в Kernel.php,пробовал использовать посредник web и auth, но безуспешно.
Это код LoginController
class LoginController extends Controller
{
public function redirect()
{
return redirect()->route('home');
}
function loginUser(Request $request)
{
$array = $request->except('remember');
$remember = $request->has('remember');
$validator = Validator::make($array, [
'name' => 'required|between:2,15|alpha_num',
'password' => 'required|between:4,15|alpha_num',
]);
if ($validator->fails()) return redirect()->route('home')->withErrors($validator)->withInput();
if (Auth::attempt([
'name' => $array['name'],
'password' => $array['password']
], $remember)
) {
//dd(Auth::user());
return redirect()->intended('/admin');
//redirect()->route('home')->with('message', 'Добро пожаловвать');
} else {
return redirect()->route('home')
->withErrors(['loginErr' => 'Такого пользователя не существует']);
}
}
}
А это список маршрутов
Route::group(['middleware' => ['breadcrumbs']], function () {
Route::get('/', 'IndexController@index')->name('home');
Route::get('/map', 'MapController@show')->name('map');
Route::get('/map/categories/{cat_name?}', 'CategoriesController@show')
->name('categories');
Route::get('/map/nations/{cat_name?}', 'NationsController@show')
->name('nations');
Route::get('/map/seasons/{cat_name?}', 'SeasonsController@show')
->name('seasons');
Route::get('/map/{category}/{cat_name}/{article_name}', 'SeparateArticleController@show')
->where('category', 'nations|seasons|categories')->name('article');
Route::post('/incrementLike', 'SeparateArticleController@incrementLike');;
});
Route::post('register', 'Auth\RegisterController@register');
Route::post('login', 'Auth\LoginController@loginUser');
Route::get('register', 'Auth\RegisterController@redirect')->name('register');
Route::get('login', 'Auth\LoginController@redirect')->name('login');
Route::group(['prefix' => 'admin'], function () {
//admin
Route::get('/', 'Admin\IndexController@show');
});
Думаю,что проблема в сессиях , так так в ней ничего не остается
P.S. Использую собственные контроллеры аутентификации(без php make:auth)
vendredi 22 décembre 2017
Error on terminal while installing django taggit via pip install on ubuntu gnome
I am getting the error on installing django-taggit module... what might be the problem? Please help I have tried everythin and it̀s still bringing the same error even tried updating my setup tools
:~$ pip install django-taggit
Collecting django-taggit
Using cached django_taggit-0.22.1-py2.py3-none-any.whl
Installing collected packages: django-taggit
Exception:
Traceback (most recent call last):
File "/home/krafty-coder/.local/lib/python3.5/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/home/krafty-coder/.local/lib/python3.5/site-packages/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/home/krafty-coder/.local/lib/python3.5/site-packages/pip/req/req_set.py", line 784, in install
**kwargs
File "/home/krafty-coder/.local/lib/python3.5/site-packages/pip/req/req_install.py", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/home/krafty-coder/.local/lib/python3.5/site-packages/pip/req/req_install.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "/home/krafty-coder/.local/lib/python3.5/site-packages/pip/wheel.py", line 345, in move_wheel_files
clobber(source, lib_dir, True)
File "/home/krafty-coder/.local/lib/python3.5/site-packages/pip/wheel.py", line 316, in clobber
ensure_dir(destdir)
File "/home/krafty-coder/.local/lib/python3.5/site-packages/pip/utils/__init__.py", line 83, in ensure_dir
os.makedirs(path)
File "/usr/lib/python3.5/os.py", line 241, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.5/dist-packages/taggit'
Web monitor if new images on a logged in page
Hello so i'm really not sure how to write this in python and a lot of the free page monitors don't do what I want it to do...
I need a way to monitor a webpage and see if there are any new images on the page and the webpage that I'm monitoring is through a login portal so I have to be logged in to be monitoring it
Anyone can give me an idea how to do this?
Thanks
Axis2 Json web service
I have a SOAP WSDL web service running in Apache Axis2.
After looking in Apache site, I have found that it is possible to configure the web service to send and get Json request.
After changing the Axis2.xml file as told, I didn’t know how to proceed. I should get my respond as Json from Java code, while meantime the web service get and sends Soap requests..
Looking for some examples, ideas ..